React Native navigation react-navigation error can not be found, or after installing the dependency, react-native-gesture-handler depends on the library.
Solution: if react-navigation has been installed
You can first npm uninstall react-navigation;
Then check the react native version. In the package.json file as follows. "react-native": "0.56.0", which is the version number, modify it to 0.56.0 and then re-run npm install
"dependencies": {
"jetifier": "^1.6.5",
"prop-types": "latest",
"react": "16.9.0",
"react-native": "0.56.0",
"uuid": "latest"
},
The operation is completed as follows
yarn add react-navigation
yarn add react-native-gesture-handler
yarn add react-navigation-stack
npm install --save react-navigation-tabs
Then some auxiliary packages are installed according to the compilation prompt
react-native bundle --platform android --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --dev false. Generate configuration files need to manually create assets directory
application
import {createBottomTabNavigator} from 'react-navigation-tabs';
import {createStackNavigator} from 'react-navigation-stack'
import {createAppContainer} from 'react-navigation';
const navigations=createStackNavigator({
App:{
screen:App
},
RNCameraDemo:{
screen:RNCameraDemo
}
})
const AppContainer = createAppContainer(navigations);
AppRegistry.registerComponent(appName, () => AppContainer);
跳转
this.navigate('demo')
navigate=(link)=>{ const {navigate} =this.props.navigation; navigate(link) }