Skip to content

Commit 5408f18

Browse files
committed
[Fabric] call setIsFabric(true) in the MainActivity
1 parent 20a8378 commit 5408f18

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

android/app/src/main/java/com/rnnewarchitectureapp/MainActivity.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.rnnewarchitectureapp;
22

33
import com.facebook.react.ReactActivity;
4+
import com.facebook.react.ReactActivityDelegate;
5+
import com.facebook.react.ReactRootView;
46

57
public class MainActivity extends ReactActivity {
68

@@ -12,4 +14,25 @@ public class MainActivity extends ReactActivity {
1214
protected String getMainComponentName() {
1315
return "RNNewArchitectureApp";
1416
}
17+
18+
// Add the Activity Delegate, if you don't have one already.
19+
public static class MainActivityDelegate extends ReactActivityDelegate {
20+
21+
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
22+
super(activity, mainComponentName);
23+
}
24+
25+
@Override
26+
protected ReactRootView createRootView() {
27+
ReactRootView reactRootView = new ReactRootView(getContext());
28+
reactRootView.setIsFabric(true);
29+
return reactRootView;
30+
}
31+
}
32+
33+
// Make sure to override the `createReactActivityDelegate()` method.
34+
@Override
35+
protected ReactActivityDelegate createReactActivityDelegate() {
36+
return new MainActivityDelegate(this, getMainComponentName());
37+
}
1538
}

0 commit comments

Comments
 (0)