/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ mport React, { Component } from 'react'; import { // AppRegistry, // Text, Platform } from 'react-native'; import {Navigator} from 'react-native-deprecated-custom-components'; import Splash from './components/login/Splash'; export default class App extends Component { // constructor(props) { // super(props); // } componentWillMount() { if (Platform.OS === 'android') { console.log(444444444); // BackAndroid.addEventListener('hardwareBackPress', this.onBackAndroid); } } render() { return ( <Navigator initialRoute={{ name: 'login', component: Splash }} configureScene={() => Navigator.SceneConfigs.FloatFromBottom} renderScene={(route, navigator) => { //返回按钮 navigator.goBack = function () { navigator.pop(); } //退出整个app navigator.exitApp = function () { let routes = navigator.getCurrentRoutes(); for (var i = 0; i < routes.length; i++) { navigator.pop(); } } return ( <route.component {...route} navigator={navigator}></route.component> ); }} /> ); } } // AppRegistry.registerComponent('react_test', () => Index);
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ mport React, { Component } from 'react'; import { // AppRegistry, // Text, Platform } from 'react-native'; import {Navigator} from 'react-native-deprecated-custom-components'; import Splash from './components/login/Splash'; export default class App extends Component { // constructor(props) { // super(props); // } componentWillMount() { if (Platform.OS === 'android') { console.log(444444444); // BackAndroid.addEventListener('hardwareBackPress', this.onBackAndroid); } } render() { return ( <Navigator initialRoute={{ name: 'login', component: Splash }} configureScene={() => Navigator.SceneConfigs.FloatFromBottom} renderScene={(route, navigator) => { //返回按钮 navigator.goBack = function () { navigator.pop(); } //退出整个app navigator.exitApp = function () { let routes = navigator.getCurrentRoutes(); for (var i = 0; i < routes.length; i++) { navigator.pop(); } } return ( <route.component {...route} navigator={navigator}></route.component> ); }} /> ); } }
最新评论
这小生活不错呀
不错,必须顶一下!
看着你还在坚持,很好
看来忙了也没时间更新博客了
NIce。学习了。。。。
网站不错!!!!
简洁实用,好文章!
不错,过来支持一下