I created a stack navigator in react native and then used it from my home screen to go to the next screen using a button, when the button is clicked I am calling
props.navigation.navigate('SS2');
SS2 is the screen I want to go to.
This is working perfectly in iOS using the expo to run the app, however this is not the case for android, I have tried Android v8.0 and v9.0, in both of them expo crashed after the button was clicked.
There is no error message thrown at the expo server / terminal, the app just crashes and closes itself.
Here are the .js files I am using:
package.json:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "^35.0.0",
"expo-linear-gradient": "^7.0.1",
"native-base": "^2.13.8",
"package.json": "^2.0.1",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-elements": "^1.2.6",
"react-native-fs": "^2.16.1",
"react-native-gesture-handler": "^1.4.1",
"react-native-ionicons": "^4.6.3",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3"
},
"devDependencies": {
"babel-preset-expo": "^7.1.0"
},
"private": true
}
App.js:
import React from 'react';
import MainNavigator from './navigation/SingUpNavigator';
export default class App extends React.Component {
render() {
return (
<MainNavigator />
);
}
}
SingUpNavigator.js:
import React from 'react';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation-stack';
import LoginRegisterScreen from '../screens/LoginRegisterScreen';
import SS2 from '../screens/register/SS2';
const MainNavigator = createStackNavigator(
{
Home: {
screen: LoginRegisterScreen
},
LoginRegisterScreen: {
screen: LoginRegisterScreen
},
SS2: {
screen: SS2
}
},
{
headerMode: 'none'
}
)
export default createAppContainer(MainNavigator);
LoginRegisterScreen.js:
...
<MainButton title="REGISTER" onPress={() => { props.navigation.navigate('SS2')}}/>;
...