Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On reloading app showing white screen not the splashscreen #55

Open
adityak16 opened this issue Oct 18, 2017 · 1 comment
Open

On reloading app showing white screen not the splashscreen #55

adityak16 opened this issue Oct 18, 2017 · 1 comment

Comments

@adityak16
Copy link

adityak16 commented Oct 18, 2017

rn-splash-screen working fine on both android & ios but on "Android" splash screen comes while starting of the app but on reloading it showing white screen.

react-native: 0.45.1
rn-splash-screen: It's forked repo.

changed part is in Bold : /rn-splash-screen/android/src/main/java/com/mehcode/reactnative/splashscreen/SplashScreenPackage.java The file contains:

package com.mehcode.reactnative.splashscreen;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.v4.content.LocalBroadcastManager;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SplashScreenPackage implements ReactPackage {
@OverRide
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}

@OverRide
public List createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
@OverRide
public List createNativeModules(
ReactApplicationContext reactContext) {
List modules = new ArrayList<>();
modules.add(new SplashScreenModule(reactContext));
return modules;
}
}

And MainActivity.java contains:

package social.xyz.app;
import com.facebook.react.ReactActivity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.mehcode.reactnative.splashscreen.SplashScreen;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@OverRide
protected void onCreate(Bundle savedInstanceState) {
// Show the js-controlled splash screen
SplashScreen.show(this, getReactInstanceManager());
super.onCreate(savedInstanceState);
}
@OverRide
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
MainApplication.getCallbackManager().onActivityResult(requestCode, resultCode, data);
}
@OverRide
protected String getMainComponentName() {
return "xyz";
}
}

@mehcode please have a look at this.

@DanNi0130
Copy link

DanNi0130 commented Jan 11, 2018

Having this same issue @mehcode any pointers on how to implement this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants