expo / ex-navigation

Route-centric navigation for React Native
997 stars 201 forks source link

Temporarily disable gestures? #422

Open joeferraro opened 7 years ago

joeferraro commented 7 years ago

I have a modal with a PanResponder and horizontal swipes are being picked up by the underlying navigation stack. Is it possible to temporarily disable navigation gestures? Cheers

JulianKingman commented 7 years ago

One option would be to push a view instead of using a modal, then use styles: {gestures: null} in the static route property. If you want it to slide up like a modal, you can use it like this:

static route = {
    navigationBar: {
      // ...
    },
    styles: {
      ...NavigationStyles.FloatVertical,
      gestures: null,
    },
  };
joeferraro commented 7 years ago

@JulianKingman appreciate it. I was trying to avoid pushing a route.

JulianKingman commented 7 years ago

It's the simplest way, but if you're set against it, you could maybe use the navigation event emitters and set the gestures based on the emitted params, but I'm not 100% sure that will work.