Skip to content

Commit

Permalink
Re-introducing the workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Jun 19, 2024
1 parent 9b03457 commit 2a105a0
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ public boolean injectModuleIntoJSGlobal() {
}

// Since https://github.com/facebook/react-native/pull/43396 this should only be needed when bridgeless is not enabled.
// We can use the enablement of "microtasks" to avoid the overhead of calling the invokeAsync on every call from C++ into JS.
if (!ReactNativeFeatureFlags.enableMicrotasks()) {
CallInvokerHolderImpl jsCallInvokerHolder = (CallInvokerHolderImpl) reactContext.getCatalystInstance().getJSCallInvokerHolder();
injectCallInvoker(jsCallInvokerHolder);
}
// but unfortunately, that doesn't seem to be the case.
// See https://github.com/facebook/react-native/pull/43396#issuecomment-2178586017 for context
// If it was, we could use the enablement of "microtasks" to avoid the overhead of calling the invokeAsync on every call from C++ into JS.
// if (!ReactNativeFeatureFlags.enableMicrotasks())

CallInvokerHolderImpl jsCallInvokerHolder = (CallInvokerHolderImpl) reactContext.getCatalystInstance().getJSCallInvokerHolder();
injectCallInvoker(jsCallInvokerHolder);

// Get the javascript runtime and inject our native module with it
JavaScriptContextHolder jsContext = reactContext.getJavaScriptContextHolder();
Expand Down

0 comments on commit 2a105a0

Please sign in to comment.