react-native 0.44使用Navigator
1、npm install react-native-deprecated-custom-components --save
2、import Navigator from 'react-native-deprecated-custom-components';
3、用到的地方使用
<Navigator.Navigator
initialRoute={{ name: defaultName, component: defaultComponent }}
configureScene={(route) => {
return Navigator.Navigator.SceneConfigs.VerticalDownSwipeJump;
}}
renderScene={(route, navigator) => {
let Component = route.component;
return <Component {...route.params} navigator={navigator} />
}} />
4、千万记得使用Navigator.Navigator,我一直直接使用<Navigator></Navigator>,总是报错,
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)
but got: object.这表明没有找到Navigator组件,查了好半天才找到问题所在。
5、或者使用这种方式:
import CustomerComponents, {Navigator}
from 'react-native-deprecated-custom-components';
<Navigator></Navigator>
以上是 react-native 0.44使用Navigator 的全部内容, 来源链接: utcz.com/z/381734.html