diff --git a/README.md b/README.md index 9eb674f9..fc0729c4 100644 --- a/README.md +++ b/README.md @@ -137,6 +137,37 @@ public class MainActivity extends ReactActivity { } ``` +Update the `MainActivity.kt` to use `react-native-splash-screen` on Apps using ReactNative >= 0.73, following the below code: + +```kt +import com.facebook.react.ReactActivity +import org.devio.rn.splashscreen.SplashScreen; +import com.facebook.react.ReactActivityDelegate +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled +import com.facebook.react.defaults.DefaultReactActivityDelegate +import android.os.Bundle + +class MainActivity : ReactActivity() { + + /** + * Returns the name of the main component registered from JavaScript. This is used to schedule + * rendering of the component. + */ + override fun getMainComponentName(): String = "App Name" + + init { + SplashScreen.show(this) + } + + /** + * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] + * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] + */ + override fun createReactActivityDelegate(): ReactActivityDelegate = + DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) +} +``` + **iOS:** Update `AppDelegate.m` with the following additions: