Skip to content

Commit

Permalink
Enable fast refresh banner
Browse files Browse the repository at this point in the history
Summary:
Fast refresh banner for Android was introduced for Bridge-only (D42286425), in this diff we enable it for Bridgeless as well.

Changelog:
[Android][Changed] - Enable fast refresh banner for Bridgeless

Differential Revision: D50318991
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed Oct 16, 2023
1 parent a2f1189 commit ba9ee9e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ public BridgeDevSupportManager(
surfaceDelegateFactory,
devLoadingViewManager);

mReactInstanceManagerHelper = reactInstanceManagerHelper;
mDevLoadingViewManager = devLoadingViewManager;

if (getDevSettings().isStartSamplingProfilerOnInit()) {
// Only start the profiler. If its already running, there is an error
if (!mIsSamplingProfilerEnabled) {
Expand All @@ -112,14 +109,6 @@ public void onOptionSelected() {
});
}

public DevLoadingViewManager getDevLoadingViewManager() {
return mDevLoadingViewManager;
}

public ReactInstanceDevHelper getReactInstanceManagerHelper() {
return mReactInstanceManagerHelper;
}

@Override
protected String getUniqueTag() {
return "Bridge";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,11 @@ public DevServerHelper getDevServerHelper() {
return mDevServerHelper;
}

protected ReactInstanceDevHelper getReactInstanceDevHelper() {
public DevLoadingViewManager getDevLoadingViewManager() {
return mDevLoadingViewManager;
}

public ReactInstanceDevHelper getReactInstanceDevHelper() {
return mReactInstanceDevHelper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.devsupport.BridgeDevSupportManager;
import com.facebook.react.devsupport.DefaultDevLoadingViewImplementation;
import com.facebook.react.devsupport.DevSupportManagerBase;
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager;
import com.facebook.react.module.annotations.ReactModule;

Expand All @@ -28,14 +28,14 @@ public class DevLoadingModule extends NativeDevLoadingViewSpec {
public DevLoadingModule(ReactApplicationContext reactContext) {
super(reactContext);
mJSExceptionHandler = reactContext.getJSExceptionHandler();
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof BridgeDevSupportManager) {
if (mJSExceptionHandler != null && mJSExceptionHandler instanceof DevSupportManagerBase) {
mDevLoadingViewManager =
((BridgeDevSupportManager) mJSExceptionHandler).getDevLoadingViewManager();
((DevSupportManagerBase) mJSExceptionHandler).getDevLoadingViewManager();
mDevLoadingViewManager =
mDevLoadingViewManager != null
? mDevLoadingViewManager
: new DefaultDevLoadingViewImplementation(
((BridgeDevSupportManager) mJSExceptionHandler).getReactInstanceManagerHelper());
((DevSupportManagerBase) mJSExceptionHandler).getReactInstanceDevHelper());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ private Task<ReactInstance> newGetOrCreateReactInstanceTask() {
final JSBundleLoader bundleLoader = task.getResult();
final BridgelessReactContext reactContext = getOrCreateReactContext();
final DevSupportManager devSupportManager = getDevSupportManager();
reactContext.setJSExceptionHandler(devSupportManager);

log(method, "Creating ReactInstance");
final ReactInstance instance =
Expand Down Expand Up @@ -1036,6 +1037,7 @@ private Task<ReactInstance> oldGetOrCreateReactInstanceTask() {

final BridgelessReactContext reactContext = getOrCreateReactContext();
final DevSupportManager devSupportManager = getDevSupportManager();
reactContext.setJSExceptionHandler(devSupportManager);

return getJsBundleLoader()
.onSuccess(
Expand Down

0 comments on commit ba9ee9e

Please sign in to comment.