Reputation: 53
In my App.tsx I'm using createNativeStackNavigator and I'm trying to dismiss the modal that is "Project_Creation" and navigate to Main
<NavigationContainer>
<Stack.Navigator>
<Stack.Group>
<Stack.Screen name="Main" component={DrawerNavigator} options={{ headerShown: false }} />
<Stack.Screen name="Details" component={ChannelDetails} />
<Stack.Screen name="Profile" component={Profile} />
</Stack.Group>
<Stack.Group screenOptions={{ stackPresentation: 'modal', headerShown: false }}>
<Stack.Screen
options={{ headerTitle: 'Create Project' }}
name="Project_Creation"
component={ProjectCreationNavigator}
/>
</Stack.Group>
</Stack.Navigator>
</NavigationContainer>
I'm not sure if it's because createNativeStackNavigator is not as customizable as createStackNavigator or if I can't navigate to another Stack Group from one of the screens in ProjectCreationNavigator but it keeps getting errors.
With navigation.dismiss() I get
navigation.dismiss() is not a function
with navigation.reset({index: 0, name: "Main"}) I get
undefined is not an object
I'd love to figure out how to navigate to "Main".
Upvotes: 1
Views: 894
Reputation: 53
Update::
I realized the problem. In separate navigator component I had NavigationContainer wrapped. When I removed that it worked
Upvotes: 1