Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,30 @@ protected ReactContext getReactContext() {
}

private void createReactContextAndScheduleTask(final HeadlessJsTaskConfig taskConfig) {
final ReactHost reactHost = getReactHost();

if (reactHost == null) { // old arch
final ReactInstanceManager reactInstanceManager =
getReactNativeHost().getReactInstanceManager();

reactInstanceManager.addReactInstanceEventListener(
if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally, worked with this slight tweak:

Suggested change
if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {
if (ReactFeatureFlags.enableBridgelessArchitecture) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's because we replaced ReactFeatureFlags with ReactNativeFeatureFlags on main, but on the release branch we still reference the old class

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah of course, and my reproducer was 0.76.2 still (not even .3)
I was confused how that even compiled otherwise and it was sailing right through CI! Makes sense

Okay, then given this was really just symbol motion, not really a semantic change, you've nailed it.

final ReactHost reactHost = getReactHost();
reactHost.addReactInstanceEventListener(
new ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
invokeStartTask(reactContext, taskConfig);
reactInstanceManager.removeReactInstanceEventListener(this);
reactHost.removeReactInstanceEventListener(this);
}
});
reactInstanceManager.createReactContextInBackground();
} else { // new arch
reactHost.addReactInstanceEventListener(
reactHost.start();
} else {
final ReactInstanceManager reactInstanceManager =
getReactNativeHost().getReactInstanceManager();

reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
invokeStartTask(reactContext, taskConfig);
reactHost.removeReactInstanceEventListener(this);
reactInstanceManager.removeReactInstanceEventListener(this);
}
});
reactHost.start();
reactInstanceManager.createReactContextInBackground();
}
}
}
Loading