We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have two tab navigators at different routes.
Is it possible to navigate to a route by pressing a tab?
I have tried
const TabNavigator1 = TabNavigator({ Home: { screen: HomeScreen, }, Exit: { screen: ({ navigation }) => { navigation.navigate('TabNavigator2') return Something // because it has to return something }, })
it actually does navigate as I wanted, but I receive a warning saying Functions are not valid as React child.
Functions are not valid as React child
It also seems a bit hacky to do it like this. Could I replace screen: ({ navigation }) => ... with something like onPress: ({ navigation }) => ...
screen: ({ navigation }) => ...
onPress: ({ navigation }) => ...
The text was updated successfully, but these errors were encountered:
According to the doc, does customizing tabBarOnPress works for you? Though it only provides a jumpToIndex() exit method. I'm not sure.
tabBarOnPress
jumpToIndex()
Sorry, something went wrong.
import { StackNavigator, TabNavigator, TabBarBottom } from 'react-navigation'; //config tabBarComponent: (props) => { return ( <TabBarBottom {...props} jumpToIndex={(index) => { //code here //ex: props.screenProps.rootNavigation.dispatch(jumpToTabYourPost(index)); }} /> ) }, initialRouteName: 'DEMO',
@mazing You may also take a look on my implementation for scrollToTop function.
#2955
Closing since tabBarOnPress option already exists.
No branches or pull requests
I have two tab navigators at different routes.
Is it possible to navigate to a route by pressing a tab?
I have tried
it actually does navigate as I wanted, but I receive a warning saying
Functions are not valid as React child
.It also seems a bit hacky to do it like this. Could I replace
screen: ({ navigation }) => ...
with something likeonPress: ({ navigation }) => ...
The text was updated successfully, but these errors were encountered: