crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.61k stars 1.1k forks source link

Bug with BACK on Android!!! #76

Open shanematte opened 7 years ago

shanematte commented 7 years ago

Hello. I have a mistake. If I exit the application via the android back button, after I reopen the application, started the splashscreen and the application hangs. How do I fix the error? React native as it has already started, and does not work SplashScreen.hide() Please HEELP

cheneywan commented 7 years ago

I have the same problem

spaquis commented 7 years ago

+1

adieunix commented 7 years ago

+1

marcioadr88 commented 7 years ago

+1

marcioadr88 commented 7 years ago

I found a workaround, is as follows: on MainActivity.java

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        ReactContext ctx = getReactInstanceManager().getCurrentReactContext();

        if(ctx == null) {
            SplashScreen.show(this);
        }

        super.onCreate(savedInstanceState);
    }
MadeBaruna commented 7 years ago

You should check which component get loaded when opened, in my case when the app open on the first time it load the SplashPage component, but after close it with back button, the MainPage component get loaded, not the SplashPage. So i add SplashScreen.hide() on both component

joncursi commented 7 years ago

I have this issue as well. Kills the UX of the app :(

barghi commented 6 years ago

same problem here

barghi commented 6 years ago

i am using react-native-router-flux and fix this problem with it's reducer

case 'Navigation/INIT':
       SplashScreen.hide();
       break;

createReducer example in react-native-router-flux: https://github.com/aksonov/react-native-router-flux/blob/master/Example/Example.js#L48

i think there is similar solution if you use other navigation library