I have a SwitchNavigator 'switch'. It's initial state 'root' is a screen component that is just loading state and determining the correct initial route (A, or B) of a StackNavigator 'stack'.
--switch
--root
--stack
-A
-B
what's the right way for the 'root' component to tell the Switch Navigator to switch to 'stack' and then start with either 'A or B' conditionally?
In the root component, when your job is done, just call navigation.navigate like this:
this.props.navigation.navigate(condition ? 'A' : 'B');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With