timomeh / react-native-material-bottom-navigation

💅🔧👌 a beautiful, customizable and easy-to-use material design bottom navigation for react-native
MIT License
709 stars 127 forks source link

Prevent Slide Tabs #63

Closed emalorenzo closed 6 years ago

emalorenzo commented 6 years ago

Discussion / Feature Request

A core difference between Tabs and BottomNavigation is the fact that they cant slide between each other. There is a way to prevent this behaviour?

Thanks in advance for all your effort!

timomeh commented 6 years ago

Do you mean by sliding this behavior?

If so, you can turn that off with shifting={false}, see https://github.com/timomeh/react-native-material-bottom-navigation#bottomnavigation

waquidvp commented 6 years ago

If it is the swiping between tabs that you are talking about, you can configure that in your TabNavigatorConfig like this:

const MyApp = TabNavigator({
  MoviesAndTV: { screen: MoviesAndTV },
  Music: { screen: Music },
  Newsstand: { screen: Newsstand }
}, {
  tabBarComponent: NavigationComponent,
  tabBarPosition: 'bottom',
  tabBarOptions: {...}
  // add this, ref from docs: swipeEnabled - Whether to allow swiping between tabs.
  swipeEnabled: false,
  // optional, animationEnabled - Whether to animate when changing tabs.
  animationEnabled: false,
})

The swipeEnabled set to false means that you no longer can swipe between the tabs, and animationEnabled set to false means that there won't be a swipe animation between tab switches, even when using the tab buttons.

emalorenzo commented 6 years ago

Thanks @waquidvp ! That was what i was looking for .