#React Native#103页面导航,弹出框,理解属性<2>
(2017-10-26 16:45:19)分类: 计算机相关 |
3,弹出框:
弹出框就是自顶一个组件,定义为整个页面,给个stateShow:true/false,来实现是否显示,然后就可以把对应的确定和取消函数来定义。另一个问题,就是如何点击其他地方取消遮罩层的问题。
4.返回键新的RN 推荐使用 1 BackAndroid.addEventListener('hardwareBackPress',
this.onBackPressed);
2 BackAndroid.removeEventListener('hardwareBackPress', this.onBackPressed);
BackHandler.addEventListener('hardwareBackPress', function() {
// this.onMainScreen and this.goBack are just examples, you need to use your own implementation here
// Typically you would use the navigator here to go to the last state.
if (!this.onMainScreen()) {
this.goBack();
return true;
}
return false;
});
译注:以上的this.onMainScreen()和this.goBack()两个方法都只是伪方法,需要你自己去实现!具体可以参考这篇博文。
方法
static exitApp()
static addEventListener(eventName, handler)
static removeEventListener(eventName, handler)
5属性检测 PropTypes ,表明组件必须要写的属性检测。