react-native-splash-screen: Not working with modified MainActivity for react-native-navigation

Unfortunately the app crash on launch. Maybe this is due to the fact that the mainactivity class has been modified which extends the SplashActivity from com.reactnativenavigation.controllers.SplashActivity rather than the old school ReactActivity class.

Yes, I’m using the react-native-navigation by wix (https://github.com/wix/react-native-navigation)

Here’s the full code of my MainActivity.java, maybe I’m just doing something wrong.

import org.devio.rn.splashscreen.SplashScreen;
import com.reactnativenavigation.controllers.SplashActivity;
import android.os.Bundle;

public class MainActivity extends SplashActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this);  // here
        super.onCreate(savedInstanceState);
    }
}

If anyone had a similar problem, please let me know for any solution thanks.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 9
  • Comments: 23

Most upvoted comments

same problem here, when to try adb logcat I found error Can't convert to color:type=0x1

solve by: created file android/app/src/main/res/values/colors.xml and setting content <?xml version="1.0" encoding="utf-8"?> <resources> <color name="primary_dark">#660B0B0B</color> </resources>

now splash screen working well with react-native-navigation on android and ios

MainActivity.java

package com.mmakmur;
import android.os.Bundle; // here
import com.facebook.react.ReactActivity;
import com.reactnativenavigation.controllers.SplashActivity;
import org.devio.rn.splashscreen.SplashScreen;

public class MainActivity extends SplashActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        SplashScreen.show(this);  // here
        super.onCreate(savedInstanceState);
    }
}

Same problem, and I wondered which step was wrong until saw this issue…

@voratham … Thanks for the reply … I have tried so many things but can’t get it to run on my application … so I ended up using react-native-smart-splash-screen library instead … I would really like to use react-native-splash-screen but I don’t have the time to play around with it as I have to deliver the app on time … so may be when I am free and will play around with it and troubleshoot the issue that I am having … Thanks for your help guys

Same problem 😕

This is my Mainactivity code and its working

package com.actnursesportal; import android.os.Bundle; import com.reactnativenavigation.NavigationActivity; import org.devio.rn.splashscreen.SplashScreen;

public class MainActivity extends NavigationActivity { @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // here super.onCreate(savedInstanceState); }

}

thank you @xabree this solved my crash on launch. Please create a pull request so that this error can be solved long term 😉