Skip to content

Commit

Permalink
[Fabric] call setIsFabric(true) in the MainActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Feb 28, 2022
1 parent 20a8378 commit 5408f18
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.rnnewarchitectureapp;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactActivityDelegate;
import com.facebook.react.ReactRootView;

public class MainActivity extends ReactActivity {

Expand All @@ -12,4 +14,25 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "RNNewArchitectureApp";
}

// Add the Activity Delegate, if you don't have one already.
public static class MainActivityDelegate extends ReactActivityDelegate {

public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
super(activity, mainComponentName);
}

@Override
protected ReactRootView createRootView() {
ReactRootView reactRootView = new ReactRootView(getContext());
reactRootView.setIsFabric(true);
return reactRootView;
}
}

// Make sure to override the `createReactActivityDelegate()` method.
@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new MainActivityDelegate(this, getMainComponentName());
}
}

0 comments on commit 5408f18

Please sign in to comment.