I have installed react-navigation in my React Native project. Its a starter project doesn't have any codes. But while running project I am facing error like this.
Here is my Navigation code
import { createStackNavigator } from 'react-navigation';
import Home from './screens/Home';
import WeatherDetail from './screens/WeatherDetail';
const Navigation = createStackNavigator({
Home: { screen: Home },
WeatherDetail: {
screen: WeatherDetail
}
});
export default Navigation;
And here is the App.js codes
import Navigator from './Router';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Navigator />
</View>
);
}
}
If I remove the navigator component from the App.js and replace it with a Text the application runs without any error.
npm install
npm install --save react-navigation
npm install --save react-native-gesture-handler
react-native link
This worked well for me as well.
1)
npm install react-navigation
2)
npm install react-native-gesture-handler
3)
npm intstall
4)
react-native link
uninstall the app
5)
react-native run-android
I used this in the CLI to solve the issue
may be its late. Temporary solution downgrade the version of react navigation:
1- unlink and uninstall react-navigation and the handler
2- add "react-navigation": "^2.18.2" to package.json
3- remove node_modules folder
4- npm i
5- react-native link
I get the same error on ios from RN v0.60
The following worked for me:
From the official doc:
If your are using React 0.60, just omit this official doc. Follow following steps:
rm react-native.config.js
if existreact-native link react-native-gesture-handler
cd ios && pod install && cd ..
react-native run-ios