question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can navigator pop gesture be disabled?

See original GitHub issue

I want to disable the swipe down to dismiss gesture for a navigator scene that’s floated in from the bottom, but I can’t figure out if it’s possible.

Also, componentWillUnmount() does not fire if the view is dismissed with a gesture.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

18reactions
ericvicenticommented, Apr 25, 2015

The scene configs are objects with lots of overridable properties in them. If you want to start with FloatFromBottom and disable gestures, you can do this:

configureScene={() => ({
  ...Navigator.SceneConfigs.FloatFromBottom,
  gestures: {}, // or null
})

The component should unmount when dismissing with a pop gesture. That might be a bug

4reactions
mwilc0xcommented, Apr 25, 2015

@ericvicenti awesome, that works!

So how about disabling only for a select few and not all screens? It seems like gestures would then need to be opt-in?

configureScene={(route) => ({
  ...route.sceneConfig || Navigator.SceneConfigs.FloatFromBottom,
  gestures: route.gestures
})}

And then when pushing a route:

// enable back gestures
this.props.navigator.push({
  title: 'Search',
  component: SearchList,
  sceneConfig: Navigator.SceneConfigs.FloatFromBottom,
  gestures: Navigator.SceneConfigs.FloatFromBottom.gestures
})

or …

// disable back gestures
this.props.navigator.push({
  title: 'Search',
  component: SearchList,
  sceneConfig: Navigator.SceneConfigs.FloatFromBottom,
  gestures: null // or just don't include this
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Flutter: Disable Swipe to Navigate Back in iOS and Android
When true your page animates a bit differently and swipe to go back on iOS will be disabled. Example usage: Navigator.of(context).push( ...
Read more >
Custom back navigation | React Native Navigation
When gesture navigation is enabled on Android, the back gesture is handled as a hardware back press. Disabling the iOS pop gesture#. The...
Read more >
Use accessibility shortcuts - Android Accessibility Help
On your device, open the Settings app. Select System and then Gestures and then System navigation. Choose your new navigation option. Shortcuts for...
Read more >
interactivePopGestureRecognizer - Apple Developer
The navigation controller installs this gesture recognizer on its view and uses it to pop the topmost view controller off the navigation stack....
Read more >
Navigation bar does not appear on Samsung phone
Tap Buttons to disable gestures and restore the navigation buttons. Buttons chose under Navigation bar. If you would prefer to keep navigation gestures...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found