I don't really understand how to set correct type to react navigation.
I got a large stack a screen, and sometimes, there are nested stack like HomeStack which is also a stack of screens.Here Settings is just a simple screen, not a stack.
<Stack.Screen name={AppStackRoutes.HomeStack} component={HomeStack} /><Stack.Screen name={AppStackRoutes.Settings} component={SettingsScreen} />
I got 2 possibilities to navigate:
- When I want to navigate into a stack and specify a screen and pass params:
navigate(AppStackRoutes.HomeStack, { screen: 'Home', userProfile } );
- When my screen is solo and I just want to pass params:
navigate(AppStackRoutes.Settings, { userProfile } );
How to get my NewScreenProps interface ?
const NewScreen = ({ navigation: { navigate, openDrawer, closeDrawer, isFocused, },}: NewScreenProps)
There is my interface, I don't know how to get a correct navigate type :
export interface NewScreenProps { navigation: { navigate: ( route: AppStackRoutes, params: ?, ) => void; openDrawer: () => void; [...] }}