I added the HeapContainer in the place of NavigationContainer and I notice that the modals reset the navigation.

This is how it looks when I open a modal( no matter which of this is displayed)

This is how the navigation/index.ts looks like:
const RootStack = createNativeStackNavigator<RootStackParamList>()
const HeapNavigationContainer =
Heap.withReactNavigationAutotrack(NavigationContainer)
return (
<HeapNavigationContainer
linking={linking as LinkingOptions<RootStackParamList>}
ref={(navigatorRef) => {
oldNavigationRef.current = navigationRef
navigationRef.current = navigatorRef
}}
onReady={handleReady}
independent
>
<RootStack.Navigator
screenOptions={{
headerShown: false,
}}
>
<RootStack.Screen name={Routes.AppSwitcher} component={AppSwitcher} />
<RootStack.Screen name={Routes.Menu} component={MenuStack} />
<RootStack.Screen name={Routes.OldApp} component={OldApp} />
<RootStack.Screen name={Routes.DefaultStack} component={DefaultStack} />
</RootStack.Navigator>
{renderModal()}
</HeapNavigationContainer>
The render modal is a method that contain a switch with different modals. Here a portion of this code:
const renderModal = useCallback(() => {
switch (modal.type) {
case 'dedupe':
return (
<DedupeModal
onClose={modal.hideModal}
isVisible={modal.isVisible}
{...modal.options}
/>
)
case 'stateSelection':
return (
<StateSelectionModal
onClose={modal.hideModal}
isVisible={modal.isVisible}
{...modal.options}
/>
)
...
Looking forward to hearing some news.
Many thanks!
Best answer by Jonas-Heap
View original