Open kennethpdev opened 7 years ago
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 initiateSplashScreen.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" notifications@github.com 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 <?xml version="1.0" encoding="utf-8"?>
<color 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?
Still the same error.:(
"react-native": "0.57.3", "react-native-splash-screen": "^3.1.1", "react-native-navigation": "^1.1.490",
The app can't run on Android but work well on iOS. And I am using react-native-navigation and set values/colors.xml. Here is my code.
Can anyone help me? Thanks a lot~~
================MainActivity.java===========================
package com.myApp;
import android.os.Bundle;
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 );
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 "myApp";
}
}
=================values/colors.xml===============================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_dark">#660B0B0B</color>
</resources>
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); }
}
My main issue was having a white screen between splash screen and my progress indicator
So I googled and found people saying that this library fixes that issue.
But when I followed the manual setup and getting started my app crashes at the start. when I comment SplashScreen.show(this) it works but with the white screen appearing.
Here is my MainActivity.Java
`package com.goldenapp; import android.os.Bundle; // here import com.facebook.react.ReactActivity; import org.devio.rn.splashscreen.SplashScreen; // here
public class MainActivity extends ReactActivity { @Override protected void onCreate(Bundle savedInstanceState) { SplashScreen.show(this); // here super.onCreate(savedInstanceState); } /**
My MainApplication.Java `package com.goldenapp;
import android.app.Application;
import com.facebook.react.ReactApplication; import com.oblador.vectoricons.VectorIconsPackage; import com.brentvatne.react.ReactVideoPackage; import com.reactnative.ivpusic.imagepicker.PickerPackage; import com.agontuk.RNFusedLocation.RNFusedLocationPackage; import com.airbnb.android.react.maps.MapsPackage; import cl.json.RNSharePackage; import org.reactnative.camera.RNCameraPackage; import com.imagepicker.ImagePickerPackage; import com.babisoft.ReactNativeLocalization.ReactNativeLocalizationPackage; import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.entria.views.RNViewOverflowPackage; import org.devio.rn.splashscreen.SplashScreenReactPackage; // import com.babisoft.ReactNativeLocalization.ReactNativeLocalizationPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import com.devfd.RNGeocoder.RNGeocoderPackage; import java.util.Arrays; import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage(),
new ReactVideoPackage(),
new PickerPackage(),
new RNFusedLocationPackage(),
new MapsPackage(),
new RNSharePackage(),
new RNCameraPackage(),
new ImagePickerPackage(),
new ReactNativeLocalizationPackage(),
new RNDeviceInfo(),
new RNGeocoderPackage(),
new RNViewOverflowPackage(),
new SplashScreenReactPackage()
// new ReactNativeLocalizationPackage()
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; }
@Override public void onCreate() { super.onCreate(); SoLoader.init(this, / native exopackage / false); } } `
My colors.xml `<?xml version="1.0" encoding="utf-8"?>
`
Unfortunately the app crash on launch. Maybe this is due to the fact that the mainactivity class has been modified which extends the
SplashActivity
fromcom.reactnativenavigation.controllers.SplashActivity
rather than the old schoolReactActivity
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.If anyone had a similar problem, please let me know for any solution thanks.