Skip to content

Instantly share code, notes, and snippets.

@parth-koshta
Created January 8, 2022 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parth-koshta/346744ceb684d311d8ee7f78b0b97013 to your computer and use it in GitHub Desktop.
Save parth-koshta/346744ceb684d311d8ee7f78b0b97013 to your computer and use it in GitHub Desktop.
Medium article - splash screen
package com.rn_base;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate; // add this line
import com.zoontek.rnbootsplash.RNBootSplash; // add this line
public class MainActivity extends ReactActivity {
// ...
/**
* This is added for react-native-bootsplash
*/
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
@Override
protected void loadApp(String appKey) {
RNBootSplash.init(MainActivity.this); // <- initialize the splash screen
super.loadApp(appKey);
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment