I am having issues passing an object through screens using react navigation : I currently have a user object received from connecting to firebase, so i know i have the object and my user is connected. However, i can't seem to find the best way to pass it to the screen after connection, which way is better ?
Like this :
navigation.navigate('User Profile', {user: user})
(This line is called after getting the document in which the user information is stored in and upon pressing the login button)
Or like this :
{ user ?(
<Tab.Screen name="User Profile">
{props => <ConnectedProfileScreen {...props} extraData={user}/>}
</Tab.Screen>
) : (
<Tab.Screen name ="Profile" component={ProfileScreen}/>
)}
(This chunk is part of my BottomTabNavigator, and renders differently based on if the mobile app is detecting a connected user or not)
Second thing, my bottom tab is rendered with "profile" at first when no user is connected, when an user connects, "User profile" is rendered in the tab replacing the "profile" tab, but when I disconnect, "user profile" is still rendered, how can I manage to re-render "profile" upon disconnect ?
question from:
https://stackoverflow.com/questions/65898264/trying-to-pass-object-through-screens-with-react-navigation 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…