1. 程式人生 > >React-Native到0.44版本後Navigator 不能用的問題

React-Native到0.44版本後Navigator 不能用的問題

base targe 問題 all pan ria been github pre

新升級 到0.46版本以後 Navigator 不能使用報錯。

‘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‘

解決方案:

1、cd 當前目錄

2、npm install react-native-deprecated-custom-components --save

3、import {Navigator} from ‘react-native-deprecated-custom-components‘;

4、

          <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} /> } } />

React-Native到0.44版本後Navigator 不能用的問題