diff options
Diffstat (limited to 'android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java')
-rw-r--r-- | android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java b/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java index c8c347ad5..ed44ef8d7 100644 --- a/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java +++ b/android/app/src/main/java/xyz/blueskyweb/pubsq/MainActivity.java @@ -2,7 +2,8 @@ package xyz.blueskyweb.app; import com.facebook.react.ReactActivity; import com.facebook.react.ReactActivityDelegate; -import com.facebook.react.ReactRootView; +import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint; +import com.facebook.react.defaults.DefaultReactActivityDelegate; import android.os.Bundle; public class MainActivity extends ReactActivity { @@ -17,30 +18,19 @@ public class MainActivity extends ReactActivity { } /** - * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and - * you can specify the rendered you wish to use (Fabric or the older renderer). + * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link + * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React + * (aka React 18) with two boolean flags. */ @Override protected ReactActivityDelegate createReactActivityDelegate() { - return new MainActivityDelegate(this, getMainComponentName()); - } - - public static class MainActivityDelegate extends ReactActivityDelegate { - public MainActivityDelegate(ReactActivity activity, String mainComponentName) { - super(activity, mainComponentName); - } - - @Override - protected ReactRootView createRootView() { - ReactRootView reactRootView = new ReactRootView(getContext()); + return new DefaultReactActivityDelegate( + this, + getMainComponentName(), // If you opted-in for the New Architecture, we enable the Fabric Renderer. - reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); - return reactRootView; - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(null); - } + DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled + // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18). + DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled + ); } } |