I am using react-navigation
and have a nested TabNavigator
inside a StackNavigator
. I have three tabs in TabNavigator
and need to set initialRouteName
for TabNavigator
dynamically based on some logic.
I have tried putting the TabNavigator
inside a React
Component with dynamically selected initial tab and used in StackNavigator
with passing props through screenProps
of TabNavigator
. But this way I am unable to navigate to any route of StackNavigator
.
Is there any way to make initialRouteName
dynamically.
Note: I am not using redux for this application.
<Tab.Navigator
initialRouteName="YOUR_TAB_NAME"
...
/>
...
Reference:https://reactnavigation.org/docs/bottom-tab-navigator/#initialroutename
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