web-ridge / react-native-paper-tabs

Smooth and fast cross platform Material Design Tabs for React Native Paper
https://reactnativepapertabs.com
MIT License
199 stars 35 forks source link

Last Tab as action button #64

Closed jonnyreeves closed 9 months ago

jonnyreeves commented 9 months ago

Is your feature request related to a problem? Please describe. I want to mimic the design of Google Tasks and have the last Tab be an action button (eg: "Create New"). In this case the user should not be able to 'swipe' to the last Tab.

Describe the solution you'd like A way to optionally disable swiping to the last tab.

Describe alternatives you've considered I tried adding a onChangeIndex to the TabsProvider, eg:

  const handleIndexChange = (idx) => {
    setDisableSwipe(idx === 2);
  };

However this will now prevent the user from swiping 'back' to the previous tab index (eg: from 2 --> 1). I only want to prevent the user from swiping right.

I wonder if we need a way to 'prevent swipe' in the onChange handler based on the 'currentIdx' and 'nextIdx' values?

Additional context Happy to give this a go if you can provide code pointers, please? Thanks!

cc @RichardLindhout

RichardLindhout commented 9 months ago

Not possible a.t.m.maybe just work around it, not a prio for us, wat you could do is path package and add rightTabBarHeaderButtons={} because in Google Taks it's not a tab (at least not in iOS).