11package com .reactnativenavigation .playground ;
22
33import android .os .Bundle ;
4- import android .view .View ;
54import android .widget .ImageView ;
6-
75import com .facebook .react .ReactActivityDelegate ;
8- import com .facebook .react .ReactRootView ;
9-
6+ import com .facebook .react .defaults . DefaultNewArchitectureEntryPoint ;
7+ import com . facebook . react . defaults . DefaultReactActivityDelegate ;
108import com .reactnativenavigation .NavigationActivity ;
119
1210import androidx .annotation .Nullable ;
1311
1412public class MainActivity extends NavigationActivity {
1513
14+ @ Override
15+ protected String getMainComponentName () {
16+ return "PlaygroundApp" ;
17+ }
18+
1619 @ Override
1720 protected void onCreate (@ Nullable Bundle savedInstanceState ) {
1821 super .onCreate (savedInstanceState );
@@ -24,4 +27,21 @@ private void setSplashLayout() {
2427 img .setImageDrawable (getDrawable (R .drawable .ic_android ));
2528 setContentView (img );
2629 }
30+
31+ /**
32+ * Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
33+ * DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
34+ * (aka React 18) with two boolean flags.
35+ */
36+ @ Override
37+ protected ReactActivityDelegate createReactActivityDelegate () {
38+ return new DefaultReactActivityDelegate (
39+ this ,
40+ getMainComponentName (),
41+ // If you opted-in for the New Architecture, we enable the Fabric Renderer.
42+ DefaultNewArchitectureEntryPoint .getFabricEnabled (), // fabricEnabled
43+ // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
44+ DefaultNewArchitectureEntryPoint .getConcurrentReactEnabled () // concurrentRootEnabled
45+ );
46+ }
2747}
0 commit comments