AppLoading won't close in standalone android app

#1

I am using react navigation, and I have a start screen that checks if the user is authenticated.

If the user is already authenticated, then it navigates to the main screen of the app, otherwise the start screen shows some login options. This works perfectly in the expo client itself. However it fails for standalone apps (only tested Android so far).

All the AppLoading props are optional and navigating to the new screen renders a new component which should remove the splash screen. Why isnt this working?

Approximately my code:

componentDidMount(){
    SecureStore.getItemAsync('MY_TOKEN').then((token) => {
      if (token) {
        this.props.authAndGoToMain({ token });
      } else {
        this.setState({ hideSplashScreen: true });
      }
    }, (err) => {
      this.setState({ hideSplashScreen: true });
    },
  );
}

render(){
  if(!this.state.hideSplashScreen){
    return <AppLoading />
  }
  return  <MyComponent />
}
0 Likes

#2

Hi! Sorry to hear you’re having issues. What happens if you turn off development mode on the packager when running in the Expo client? (you can do this with the --no-dev flag in exp and clicking the gear icon in XDE and unchecking development mode).

0 Likes

closed #3

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

0 Likes