My English is not good, I apologize in advance. I am using React native tab menu. But user login and profile sections appear at the same time. For this, I hide it if there is a token. But when I steer, my profile does not appear. It only appears when I click on another tab. I guess it doesn't appear instantly because it waits with await.
let token = null;export default function BottomTabNavigator({ navigation, route }) { navigation.setOptions({ headerTitle: getHeaderTitle(route) }); _getToken(); return (<BottomTab.Navigator initialRouteName={INITIAL_ROUTE_NAME}> {token ?<BottomTab.Screen name="Profile" component={ProfileScreen} options={{ title: 'Profilim', tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="md-person" />, }} /> : <BottomTab.Screen name="Login" component={LoginScreen} options={{ title: 'Giriş Yap', tabBarIcon: ({ focused }) => <TabBarIcon focused={focused} name="md-person" />, }} />} </BottomTab.Navigator> );}async function _getToken() { try { token = await AsyncStorage.getItem('token'); } catch (error) { console.log(error); }};