1

I have looked every related topic on StackOverflow without success.

I am trying to go from a tab to another using "navigation.navigate" while passing a param. The navigation works but the param does not get passed.

here is what my TabNavigator looks like:

const handleTabPress = ({ navigation }) => {
  navigation.navigate(navigation.state.routeName);
  navigation.popToTop();
};

export default createBottomTabNavigator(
  {
    Overview: {
      screen: OverviewStack,
      navigationOptions: {
        title: "Home",
        tabBarOnPress: handleTabPress,
        gesturesEnabled: false,
      },
    },
    Profile: {
      screen: ProfileStack,
      resetOnBlur: true,
      navigationOptions: {
        title: "Profile",
        tabBarOnPress: handleTabPress,
        gesturesEnabled: false,
      },
    },
....

And my profileStack looks like this

const MainProfileStack = createStackNavigator(
  {
    ...ProfileRoutes,
  },
  {
    initialRouteName: "Profile",
    resetOnBlur: true,
    defaultNavigationOptions: ({ navigation }) => ({
      ...SharedHeader(navigation),
    }),
  }
);

const ProfileStack = createStackNavigator(
  {
    ProfileMain: MainProfileStack,
  },
  {
    mode: "modal",
    headerMode: "none",
  }
);
Yujin Dong
  • 483
  • 2
  • 12
  • You can refer [https://stackoverflow.com/questions/61258731/passing-params-to-tab-navigator-react-navigation-5](https://stackoverflow.com/questions/61258731/passing-params-to-tab-navigator-react-navigation-5). Please you mention the library and version. – FnH Aug 24 '21 at 18:55
  • I read that but didn't solve my problem. – Yujin Dong Aug 24 '21 at 19:10

1 Answers1

0

You can always use redux to share data.

FnH
  • 587
  • 4
  • 5