How to migrate from drawerLockMode to swipeEnabled for drawer navigator #9931
Answered
by
iamshadmirza
iamshadmirza
asked this question in
Q&A
-
Earlier when I was using the drawer navigator, I had to lock the drawer from opening on all the child screens. I did that like this: HomeStackNavigator.navigationOptions = ({ navigation }) => {
let drawerLockMode = 'unlocked';
if (navigation.state.index > 0) {
drawerLockMode = 'locked-closed';
}
return {
drawerLockMode,
};
}; But now, the prop I tried using I have drawer as top most screen followed by stack navigator. |
Beta Was this translation helpful? Give feedback.
Answered by
iamshadmirza
Sep 14, 2021
Replies: 1 comment
-
I figured it out, adding the answer for future reference import { getFocusedRouteNameFromRoute } from '@react-navigation/core';
.
.
..
screenOptions={({ route }) => {
const routeName = getFocusedRouteNameFromRoute(route) ?? 'Feed';
return {
swipeEnabled: routeName === 'Feed',
};
}} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
iamshadmirza
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I figured it out, adding the answer for future reference