Using AsyncStorage in Apploading will cause SplashScreen stuck sometime in Android

Environment

  Expo CLI 3.4.1 environment info:
    System:
      OS: Linux 5.0 Ubuntu 18.04.3 LTS (Bionic Beaver)
      Shell: 4.4.20 - /bin/bash
    Binaries:
      Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
      npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5977832
    npmPackages:
      expo: ^35.0.0 => 35.0.0 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz => 0.59.8 
      react-navigation: ^4.0.10 => 4.0.10 

Question Description

I use ComponentDidMount to read something from AsyncStorage in Apploading, such as:

class Loading extends React.Component {
  ComponentDidMount() {
    AsyncStorage.multiGet(["a", "b", "c"]).then( data => {
      do-something...
      return routeName;
    }).then( routeName => {
      this.props.navigation.navigate(routeName)
    });
 }
 render() {
    return (
    <Apploading {autoHideSplash={false}} />
    )
 }
}

And then, I will call SplashScreen.hide in the routeName page.

What’s the error?

Actually, it works well for the most time. But it will stuck in SplashScreen a lot of time in Android for sometime. What’s the problem? Is there any conflict between SplashScreen and Asynctorage in the underlayer?

Some reference

I also try to issue it and search some materials. May it help? But I don’t know a lot for the underlayer.

https://github.com/react-native-community/async-storage/issues/165
https://github.com/react-native-community/async-storage/pull/160

It looks like a bug for AsyncStorage. And react-native-community/async-storage has fix it, but as an Expo user, what should I do?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.