新升級 到0.46版本之後 Navigator 不能使用報錯。html
'Navigator is deprecated and has been removed from this package. It can now be installed ' +
'and imported from `react-native-deprecated-custom-components` instead of `react-native`. ' +
'Learn about alternative navigation solutions at http://facebook.github.io/react-native/docs/navigation.html'node
解決方案:react
一、cd 當前目錄git
二、npm install react-native-deprecated-custom-components --savegithub
三、import {Navigator} from 'react-native-deprecated-custom-components';npm
四、react-native
<Navigator initialRoute={{ name: '首頁', component: Home }} //配置場景 configureScene= { (route) => { //這個是頁面之間跳轉時候的動畫,具體有哪些?能夠看這個目錄下, //有源代碼的: node_modules/react-native/Libraries/CustomComponents/Navigator/NavigatorSceneConfigs.js // return Navigator.SceneConfigs.PushFromRight; return ({ ...Navigator.SceneConfigs.PushFromRight, gestures: null, }); } } renderScene={ (route, navigator) => { let Component = route.component; return <Component {...route.params} navigator={navigator} /> } } />