ericvicenti / navigation-rfc

Better Navigation in React Native
440 stars 44 forks source link

Disable swipe for NavigationCard? #49

Open aksonov opened 8 years ago

aksonov commented 8 years ago

Could i disable swipe for NavigationCard?

ericvicenti commented 8 years ago

@hedgerwang has an upcoming way to do this. Hedger, can we be sure to add it to the docs?

hedgerwang commented 8 years ago

@ericvicenti : I'll do that once my latest diff lands.

5amfung commented 8 years ago

Any update?

hedgerwang commented 8 years ago

@5amfung

You can disable the gesture by doing this.

<NavigationCard panHandlers={null} />
jarredwitt commented 8 years ago

Any chance we could get panHandlers={null} to transfer to the NavigationCard when using a NavigationCardStack?

ericvicenti commented 8 years ago

@jarredwitt That sounds reasonable. Feel free to send a PR and tag me and/or Hedger

jarredwitt commented 8 years ago

@ericvicenti Will do. I also noticed that NavigationCard doesn't take the direction prop anymore. Was that intentional?

hedgerwang commented 8 years ago

@jarredwitt:

NavigationCardStack is primarily a simple component with canned "built-in" animation and gestures. The prop direction direction says that you can decide how the transition and gesture should be handled with just one property.

However, once you start to let people "customize" this component, the prop "direction" may not make sense at all cause it not not necessarily match to what the animation style and gesture pan-handlers are doing.

To be honest, I'm seriously considering removing NavigationCardStack and NavigationCard from the source code otherwise we'd end up with a component with countless of "customization" props that can't be defined stickily without contradicts to one or another.

We've made such mistake with Navigator by allowing people adding random APIs to it instead of provide proper building blocks.

My advice of the replacement of NavigationCardStack will be just like this:

      <NavigationAnimatedView
        navigationState={navigationState}
        renderOverlay={renderOverlay}
        renderScene={renderScene}
      />