Skip to content

Commit

Permalink
Fix concurrentRoot warning in bridgeless for Logbox
Browse files Browse the repository at this point in the history
Summary:
When creating the react root for Logbox, we do not pass the concurrentRoot option leading to a warning because it is using Fabric.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D50558855

fbshipit-source-id: ed4399293ca4001bf4e0e059a0eb73481bcf4832
  • Loading branch information
javache authored and facebook-github-bot committed Oct 23, 2023
1 parent d4ad19c commit e5a91d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,6 @@ protected Activity getPlainActivity() {
* @return true if Fabric is enabled for this Activity, false otherwise.
*/
protected boolean isFabricEnabled() {
return false;
return ReactFeatureFlags.enableFabricRenderer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public ReactDelegate(
@Nullable String appKey,
@Nullable Bundle launchOptions,
boolean fabricEnabled) {
mFabricEnabled = fabricEnabled;
mActivity = activity;
mMainComponentName = appKey;
mLaunchOptions = composeLaunchOptions(launchOptions);
mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer();
mReactNativeHost = reactNativeHost;
mFabricEnabled = fabricEnabled;
}

public void onHostResume() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,11 @@ public JavaScriptExecutorFactory getJavaScriptExecutorFactory() {
Activity currentActivity = getCurrentActivity();
if (currentActivity != null) {
ReactRootView rootView = new ReactRootView(currentActivity);
rootView.setIsFabric(ReactFeatureFlags.enableFabricRenderer);
rootView.startReactApplication(ReactInstanceManager.this, appKey, null);
boolean isFabric = ReactFeatureFlags.enableFabricRenderer;
rootView.setIsFabric(isFabric);
Bundle launchOptions = new Bundle();
launchOptions.putBoolean("concurrentRoot", isFabric);
rootView.startReactApplication(ReactInstanceManager.this, appKey, launchOptions);
return rootView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import com.facebook.infer.annotation.Nullsafe;
import com.facebook.react.bridge.JSBundleLoader;
Expand Down Expand Up @@ -134,9 +135,11 @@ public JavaScriptExecutorFactory getJavaScriptExecutorFactory() {
public View createRootView(String appKey) {
Activity currentActivity = getCurrentActivity();
if (currentActivity != null && !reactHost.isSurfaceWithModuleNameAttached(appKey)) {
ReactSurfaceImpl reactSurface =
ReactSurfaceImpl.createWithView(currentActivity, appKey, null);
Bundle launchOptions = new Bundle();
launchOptions.putBoolean("concurrentRoot", true);

ReactSurfaceImpl reactSurface =
ReactSurfaceImpl.createWithView(currentActivity, appKey, launchOptions);
reactSurface.attach(reactHost);
reactSurface.start();

Expand Down

0 comments on commit e5a91d7

Please sign in to comment.