Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

How can I do React navigation user actions?

$
0
0

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);  }};

Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>