One thing that is a little confusing is the difference between the route name and the key and why you should use one against the other. And how are duplicate route names handled.
https://reactnavigation.org/docs/navigators/navigation-prop
This suggests that you are using routeName to navigate to the screen and that key is "a unique identifier used to sort routes." What does it mean?
It seems that the route name should not be unique, as shown in my example, since the outer tab and inner stack have the same route name. When you use navigation functions - you pass the name of the route, right? If so, how does it distinguish duplicate route names in nested navigators and when do you use the key instead?
export TabsNavigator = TabNavigator({ Home: { screen:StackNavigator({ Home: { screen: HomeScreen }, }), }, Profile: { screen: StackNavigator({ Profile: { ProfileScreen }, }), }, });
The documentation has an example of setting a key, but I cannot understand the context of what it is trying to do, or why you would do it in real use. https://reactnavigation.org/docs/navigators/navigation-prop
import { NavigationActions } from 'react-navigation' const setParamsAction = NavigationActions.setParams({ params: {},
react-native react-navigation
MonkeyBonkey
source share