DEV Community

Discussion on: React Navigation and StackNavigator to navigate Error

Collapse
 
bartmr profile image
Bartmr • Edited

I didn't understand your Gist, but it's possible that your nested navigators aren't connected in a consistent tree where navigator screens are composed of more navigators using createStackNavigator or others. Example:

WRONG way:

RootNavigator {
--Screen1: React Component which renders a navigator {
----NestedScreen1,
----NestedScreen2
--},
--Screen2: React Component
}

RIGHT way:

RootNavigator {
--Screen1: createStackNavigator({
----NestedScreen1: ReactComponent,
----NestedScreen2: createTabNavigator(
------SuperNestedScreen1: React Component
------SuperNestedScreen2: React Component
----)
--}),
--Screen2: React Component
}


You can create a React Component that IS a navigator at the same time, but that's described in the docs. Happy Coding. React Native really rocks.