Unable to hide my drawer under screens? - react-navigation
Current Behavior
I tried to use transition for opening and closing my drawer but there is a problem that is my drawer is over my screen which is not satisfying. I want my screens become over my drawer. you can clearly see below:
Expected Behavior
I expect to get this result:
my code in on navigation which I implement this transition effect
const IntroStack = createStackNavigator();
const IntroNavigation = () => {
return (
<NavigationContainer>
<IntroStack.Navigator>
<IntroStack.Screen name='intro' component={Intro} options={{ headerShown: false }} />
<IntroStack.Screen name='login' component={Login} options={{ headerShown: false }} />
<IntroStack.Screen name='createAccount' component={CreateAccount} options={{ headerShown: false }} />
<IntroStack.Screen name='forgotPassword' component={ForgotPassword} options={{ headerShown: false }} />
<IntroStack.Screen name='enterCode' component={EnterCode} options={{ headerShown: false }} />
<IntroStack.Screen name='changePassword' component={ChangePassword} options={{ headerShown: false }} />
<IntroStack.Screen name='home' component={DrawerNavigation} options={{ headerShown: false }} />
<IntroStack.Screen name='notfications' component={Notifications} options={{ headerShown: true }} />
</IntroStack.Navigator>
</NavigationContainer>
)
}
const Drawer = createDrawerNavigator();
const DrawerNavigation = () => {
const dimentions = useWindowDimensions();
const [progress, setProgress] = useState(new Animated.Value(0));
const rotate = Animated.interpolate(progress, {
inputRange: [0, 1],
outputRange: [0, -0.33],
});
const scale = Animated.interpolate(progress, {
inputRange: [0, 1],
outputRange: [1, 0.8],
});
const screenStyles = { transform: [{ rotate, scale }] }
return (
<Drawer.Navigator drawerType='slide' drawerStyle={{width: 250}} overlayColor='transparent' sceneContainerStyle={{backgroundColor: '#3170FF'}} drawerContent={
(props) => {
setProgress(props.progress);
return <DrawerContent {...props} />
}}>
<Drawer.Screen name="Home">
{(props) => <TabNavigation style={screenStyles} />}
</Drawer.Screen>
</Drawer.Navigator>
);
}
const Tab = createBottomTabNavigator();
const TabNavigation = (props) => {
return (
<Animated.View style={[{ flex: 1, backgroundColor: '#F3F9FF'}, props.style]}>
<Tab.Navigator tabBarOptions={{
style: {
borderTopLeftRadius: 23,
borderTopRightRadius: 23,
height: 70,
alignItems: 'center',
}
}} >
<Tab.Screen name="Home" component={Home} options={{
tabBarButton: (props) => <TabComponent label='home' {...props} />,
}} />
<Tab.Screen name="WorldTour" component={WorldTour} options={{
tabBarButton: (props) => <TabComponent label='earth' {...props} />,
}} />
<Tab.Screen name="Outlet" component={Outlet} options={{
tabBarButton: (props) => <TabComponent label='compass' {...props} />,
}} />
<Tab.Screen name="ChrisLeong" component={ChrisLeong} options={{
tabBarButton: (props) => <TabComponent label='crown' {...props} />,
}} />
<Tab.Screen name="OurTherapists" component={OurTherapists} options={{
tabBarButton: (props) => <TabComponent label='joint' {...props} />,
}} />
</Tab.Navigator>
</Animated.View>
);
}
export default IntroNavigation;
dependencies
"dependencies": { "@react-native-community/masked-view": "0.1.10", "@react-navigation/bottom-tabs": "^5.10.0", "@react-navigation/drawer": "^5.10.0", "@react-navigation/native": "^5.7.3", "@react-navigation/stack": "^5.9.0", "expo": "~38.0.8", "expo-status-bar": "^1.0.2", "react": "~16.11.0", "react-dom": "~16.11.0", "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz", "react-native-gesture-handler": "~1.6.0", "react-native-reanimated": "~1.9.0", "react-native-safe-area-context": "~3.0.7", "react-native-screens": "~2.9.0", "react-native-segmented-control-tab": "^3.4.1", "react-native-svg": "^12.1.0", "react-native-web": "~0.11.7", "react-navigation": "^4.4.0" }, "devDependencies": { "@babel/core": "^7.8.6", "babel-preset-expo": "~8.1.0" },
4 Answer:
Couldn't find version numbers for the following packages in the issue:
- @react-navigation/native
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
- @react-navigation/bottom-tabs
(found: 5.10.0
, latest: 5.10.7
)
- @react-navigation/drawer
(found: 5.10.0
, latest: 5.10.7
)
- @react-navigation/native
(found: 5.7.3
, latest: 5.8.7
)
- @react-navigation/stack
(found: 5.9.0
, latest: 5.12.4
)
Can you verify that the issue still exists after upgrading to the latest versions of these packages?
node_modules/react-navigation-tabs/src/views/BottomTabBar.js
//line 296
this.state.keyboard && isIos == false ? null:
You need to implement a custom navigator to have such animation.
Read next
- Authentication question - Ruby google-cloud-ruby
- Allow native SDK options to be specified by user without needing to re-initialize native SDK. - TypeScript sentry-react-native
- [question] 502/499 errors when calling Centrifugo API - centrifugo
- Can you update the readme to include Windows users with private repo dependencies? - docker
- opencv File "tf_text_graph_ssd.py", assert(graph_def.node[0].op == 'Placeholder') AssertionError - Cplusplus
- design-system unable to successfully run full-start - JavaScript
- RecursiveComparisonDifferenceCalculator fails with IllegalStateException: Duplicate key - assertj-core
- implement better way to select GL profile - Java processing