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

Not getting selected tab name #91

Closed sandeepsinghs closed 6 years ago

sandeepsinghs commented 6 years ago

While selecting specific tab from bottom navigation bar and trying to log the name of selected tab then getting as [object Object].

I want to know the selected tab so that I can navigate to specific screen.

Please help.

timomeh commented 6 years ago

onTabChange has as parameter the tab object, not only the tab key. You can get the key with

onTabChange = newTab => {
  console.log(newTab.key)
}

It seems like the documentation is wrong about that. I'm going to fix that.

timomeh commented 6 years ago

Sorry, of course it's onTabPress, not onTabChange.

sandeepsinghs commented 6 years ago

Thank you @timomeh

sandeepsinghs commented 6 years ago

I need one more help please.

After knowing pressed name of tab I need to replace the above View of BottomNavigation to other specific view act as navigating to multiple view on clicks of tab.

I am beginner for react native. Please help.

timomeh commented 6 years ago

I updated the wrong docs, thus I'm going to close this issue. Thank you for pointing this out.

After knowing pressed name of tab I need to replace the above View of BottomNavigation to other specific view act as navigating to multiple view on clicks of tab.

For this case you need a Navigation Library, such as react-navigation or react-native-navigation. Navigating is not a part of react-native-material-bottom-navigation.