Skip to content

Instantly share code, notes, and snippets.

@acro5piano
Created June 12, 2020 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acro5piano/837986cd670a799a917c3217ff145221 to your computer and use it in GitHub Desktop.
Save acro5piano/837986cd670a799a917c3217ff145221 to your computer and use it in GitHub Desktop.
conditionally changes screen gestures in React Navigation
const Screens = {
Home: 'Home',
Settings: 'Settings',
}
const Navigation = createStackNavigator(
{
[Screens['Home']]: Home,
[Screens['Settings']]: Settings,
},
{
navigationOptions: ({ navigation }) => {
const currentRoute = navigation.state.routes[navigation.state.index]
return {
gesturesEnabled: currentRoute.routeName === Screens['Settings'],
}
},
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment