Dynamically toggle swipeEnabled on MaterialTopTabNavigator in React Native

559 views Asked by At

I'm using the Material Top Tab Navigator from React Native Navigation, created with createMaterialTopTabNavigator(). As per the documentation, this function accepts a TabNavigatorConfig object as the second argument, which has a property swipeEnabled determining if you should be able to swipe between the different tabs.

The issue is, I normally want the swipe behavior enabled, but only want to disable it under certain circumstances. Is there a way to toggle this between true and false dynamically once a certain event is triggered in one of the tabs?

1

There are 1 answers

1
satya164 On

You need to use React Navigation 5 (currently alpha) for dynamic configuration:

https://next.reactnavigation.org/