如何在加载下一页或退出时显示活动指示器?

问题描述

退出我的应用程序时,在服务器收到响应然后将响应发送到我的手机之前有几秒钟的停顿。在中间阶段,屏幕上没有任何反应来说明正在发生的事情。我将如何使用 React Native 中的活动指示器来实现这一点?下面是我的一些代码

抽屉部分:

    <Drawer.Section style={styles.bottomDrawerSection}>     
            <DrawerItem
            icon={({color,size }) => (
                <Icon 
                    name="exit-to-app"
                    color={color}
                    size={size}
                    />
            )}
            label= {i18n.t('out')}
            onPress = {() => {signOut()}} 
    
        />
        </Drawer.Section>

执行注销响应的源文件中的代码

 signOut: async() =>{
      let response = await client_instance.logout()
      console.log(response)
      try{
        await AsyncStorage.removeItem('userToken');
      } catch(e) {
        console.log(e);
        }
    @R_404_6422@patch({type: 'logoUT'});
   },

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)