Closed ivandortulov closed 10 months ago
Hello @ivandortulov
We're also using <StackNavigator />
and everything seems to be working well. Are you using the <DraxProvider />
inside the stack screen? Can you provide a reproducible repository?
Ah ... that was the issue. I was not using a DraxProvider inside the stack. I had it placed inside the navigation container only:
<GestureHandlerRootView style={{flex: 1}}>
<NavigationContainer theme={AppTheme}>
<DraxProvider>
<CourtProvider>
<SideNavigation /> // <--- This contains a Side Bar Navigator + Stack Navigator
</CourtProvider>
</DraxProvider>
</NavigationContainer>
</GestureHandlerRootView>
@ivandortulov So does this fix your issue? Do you need for any reason to wrap your screens with a <DraxProvider />
?
Adding DixaProvider as the root of my screens does solve the issue. If I do not make it the root view of my screens but instead have it as a root view for the navigators is when it does not work, i.e.:
NOT Working:
<GestureHandlerRootView style={{flex: 1}}>
<NavigationContainer>
<DraxProvider>
<Tab.Navigator>
<Tab.Screen name="Home" component={() =>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Notifications" component={Notifications} />
</Stack.Navigator>
} />
</Tab.Navigator>
</DraxProvider>
</NavigationContainer>
</GestureHandlerRootView>
Working:
<GestureHandlerRootView style={{flex: 1}}>
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name="Home" component={() =>
<Stack.Navigator>
<Stack.Screen name="Home" component={() => <DraxProvider><Home /></DraxProvider>} />
<Stack.Screen name="Notifications" component={() => <DraxProvider><Notifications /></DraxProvider>} />
</Stack.Navigator>
} />
</Tab.Navigator>
</NavigationContainer>
</GestureHandlerRootView>
Description
What can be causing this issue?
Everything seemed to be working until I installed @react-navigation/stack and placed the Draggable view insiede a Stack Navigator.
If I move it outside of the Stack Navigator, everything works. I believe the Stack Navigator has some gesture detectors and it conflicts with Drax.
This is the logs I am getting with debug:
Versions
react-native: 0.72.7 react-native-gesture-handler: 1.8.0 react-navigation/bottom-tabs: 6.5.11 react-navigation/native: 6.1.9 react-navigation/native-stack: 6.9.17 react-navigation/stack: 6.3.20