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.
Same problem :/
I use it know : https://github.com/react-native-component/react-native-smart-splash-screen .. And it's working
@MisterAlex95 it worked for you? can you show me your MainActivity.java
Same problem, and I wondered which step was wrong until saw this issue...
import android.content.Intent;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import com.reactnativenavigation.controllers.SplashActivity;
import com.reactnativecomponent.splashscreen.RCTSplashScreen;
public class MainActivity extends SplashActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
RCTSplashScreen.openSplashScreen(this);
super.onCreate(savedInstanceState);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}
}
@kenma9123
@MisterAlex95 that's a different splash screen library. That's react-native-splashscreen by remobile not react-native-splash-screen by crazycodeboy. But I probably try that if it really works.
Oh yeah sorry, bad link in my msg !, i've edit the msg.
Same problem here
I can confirm @MisterAlex95 method works on RN .47.1 with this splash plugin https://github.com/react-native-component/react-native-smart-splash-screen
Same problem here
Hello Guys ... I am having the same problem ... App crashes on startup ... I have followed the installation steps correct .... here is my MainActivity.java. I am not sure what is the issue here .
package com.testapp;
import android.os.Bundle;
import com.facebook.react.ReactActivity;
import org.devio.rn.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
SplashScreen.show(this);
super.onCreate(savedInstanceState);
}
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "testApp";
}
}
I'm no longer experiencing the problem, but not sure what helped. @Base29, try running adb logcat and have a look at error stacktrace. Also what's your react-native and react-native-splash-screen versions?
@Barylskyigb ... Thanks for the reply ... My react native version is 0.50.4 and I have installed react-native-splash-screen using npm install so I believe it is the latest one 3.0.6 ... The issue somehow generated when I initiate SplashScreen.show(this) in the onCreate method ... When i remove SplashScreen.show(this) the app starts normally ofcourse without a splash screen ... what could be that I am doing wrong here ? Also I will run logcat and will get back to you.
@Base29 same as you, But I have using react-native-navigation, I don't know library can compatible. By I find a solution that we will implement on native code of ios, android.
react native version is 0.50.4 react version 16.0.0 react-native-splash-screen version ^3.0.6 react-native-navigation version ^1.1.298
@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 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);
}
}
@xabree that could be a solution. Can you turn this to a pull request, update the docs for example. Unless there's a better way to modify it on the code without creating the color xml.
Wow ... Just saw my logcat and same error message... I think this will resolve the issue
Sent from Mobile Device
On Dec 9, 2017 3:33 PM, "xabree" [email protected] wrote:
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
name="primary_dark">#660B0B0B 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); }}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/crazycodeboy/react-native-splash-screen/issues/127#issuecomment-350447726, or mute the thread https://github.com/notifications/unsubscribe-auth/AE-qLAJxKUKF-HWIkXn6ea_mA2A7gj4xks5s-mHtgaJpZM4QjgxP .
thank you @xabree this solved my crash on launch. Please create a pull request so that this error can be solved long term ;)
if i'am make device with emulator is not errror, but i'am make build apk and run with android real device error? somebody pleas help me?