2

I have a stack navigator inside a tab navigator, and when I navigate to a screen within that stack from another tab parameters are not available on the stack screen the first time through. After that, they are as expected. Here's the stack nav that's in the tab:

export function FindGasNavigator({ route }: StackScreenProps<AppTabsParamList, typeof Nav.App.Tabs.FindGas.$name>) {
  const theme = useThemeProperties();
  return (
    <FindGasStack.Navigator
      <FindGasStack.Screen
        name={Nav.App.Tabs.FindGas.StationList}
        component={StationListScreen}
      />
    </FindGasStack.Navigator>
  );
}

And I'm navigating to it as follows:

          navigation.navigate(Nav.App.Tabs.FindGas.$name, {
            screen: Nav.App.Tabs.FindGas.StationList,
            params: {
              actions: ['doSomething'],
            },
          });

So you would expect in the StationListScreen to get route.params.actions to be the array with doSomething, but it is, instead, an empty array (which is even weirder frankly) on the first run through the StationListScreen function. When navigating to it AGAIN, it comes through as expected.

Max Metral
  • 261
  • 3
  • 12

0 Answers0