React native参考手册
APIs
BackHandler
检测硬件按钮用于后退导航。
Android:检测硬件后退按钮,并且如果没有侦听器或者如果没有侦听器返回true,则以编程方式调用默认后退按钮功能以退出应用程序。
tvOS:检测电视遥控器上菜单按钮的按下。(还有待实现:如果没有侦听器或者没有侦听器返回true,则以编程方式禁用菜单按钮处理功能以退出应用程序。)
iOS:不适用。
事件订阅按相反的顺序调用(即最后注册的订阅),如果一个订阅返回true,则不会调用先前注册的订阅。
Example:
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;
});
方法
static exitApp()
static addEventListener(eventName, handler)
static removeEventListener(eventName, handler)
APIs相关
React Native 是一个 JavaScript 的框架,用来撰写实时的、可原生呈现 iOS 和 Android 的应用。
主页 | https://facebook.github.io/react-native/ |
源码 | https://github.com/facebook/react-native |
发布版本 | 0.49 |