React-native-splash-screen: how to use with wix navigation v2

Created on 18 Sep 2018  路  7Comments  路  Source: crazycodeboy/react-native-splash-screen

App crashing when we use with Wix navigation v2 with react-native-splash-screen.

mainapplication.js

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.toast.RCTToastPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.facebook.reactnative.androidsdk.FBSDKPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.reactnativenavigation.NavigationApplication;
import com.reactnativenavigation.react.NavigationReactNativeHost;
import com.reactnativenavigation.react.ReactGateway;
import java.util.Arrays;
import java.util.List;

import org.devio.rn.splashscreen.SplashScreenReactPackage;

public class MainApplication extends NavigationApplication {

@Override
protected ReactGateway createReactGateway() {
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
@Override
protected String getJSMainModuleName() {
return "index";
}
};
return new ReactGateway(this, isDebug(), host);
}

@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}

 protected List<ReactPackage> getPackages() {
    // Add additional packages you require here
    // No need to add RnnPackage and MainReactPackage
    return Arrays.<ReactPackage>asList(
        new SplashScreenReactPackage()
        // eg. new VectorIconsPackage()
    );
}

 @Override
public List<ReactPackage> createAdditionalReactPackages() {
    return getPackages();
}



//   @Override
//     public boolean getUseDeveloperSupport() {
//         return BuildConfig.DEBUG;
//     }

}

mainactivity.java
import com.reactnativenavigation.NavigationActivity;

import android.os.Bundle; // here
import org.devio.rn.splashscreen.SplashScreen; // here
//import com.reactnativecomponent.splashscreen.RCTSplashScreen; //import RCTSplashScreen

public class MainActivity extends NavigationActivity {

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

please help to solve this issue thanks in advance

All 7 comments

i also need help

got mine to work. have you added the layout xml?

@damathryx @jdileep14
Did you find any solution ?

Also looking for a solution to this and if you managed to integrate hide method with Android successfully

@damathryx Could you please post the solution since you got it to work?

Here how it works
Tested on React Native 0.59.8, React-native-navigation 2.20.1

File MainActivity.java full code

import android.os.Bundle;
import org.devio.rn.splashscreen.SplashScreen;

import com.reactnativenavigation.NavigationActivity;

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

I think it could be closed and maybe add this in install tutorial

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jetre219 picture jetre219  路  4Comments

TsuryKnox picture TsuryKnox  路  5Comments

js1121302139 picture js1121302139  路  5Comments

zhaogao picture zhaogao  路  4Comments

arnsa picture arnsa  路  5Comments