I am trying to pass a props called user through stack navigation to my many page components and it isn't working for some reason. Yet the props could be passed from Tab Navigation to this Stack Navigation component (i am using nested navigation).
const StackNavigator = (props) => {
return (
<Stack.Navigator>
<Stack.Screen
name="Home"
options={{ headerShown: false }}
>
{props => <Home user={props.user} />}
</Stack.Screen>
<Stack.Screen
name="Necessities"
options={{ headerShown: false }}
>
{props => <Necessities user={props.user} />}
</Stack.Screen>
<Stack.Screen
name="Entertainment"
options={{ headerShown: false }}
>
{props => <Entertainment user={props.user} />}
</Stack.Screen>
<Stack.Screen
name="Personal"
options={{ headerShown: false }}
>
{props => <Personal user={props.user} />}
</Stack.Screen>
<Stack.Screen
name="TransactionPage"
options={{ headerShown: true }}
component={TransactionPage}
/>
</Stack.Navigator>
);
};
I'm using the method from the documentation, https://reactnavigation.org/docs/hello-react-navigation/#passing-additional-props yet it doesn't work??? When I go to any of my components such as Personal , props is undefined.