mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Make setJSEngineResolutionAlgorithm a public method (#36715)
Summary: `setJSEngineResolutionAlgorithm` is marked as private while it looks like it was intended to be public. While the current implementation does not cause any issues as such, but in brownfield we will have the option to explicitly set the JS engine to hermes or jsc when initialising the ReactInstanceBuilder. Right now, we look if the engine is set and if unset we look for the jsc engine. If jsc is not present we select hermes and this process unnecessary throws a warning. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [ANDROID][FIXED] - Changed the scope of `setJSEngineResolutionAlgorithm` to public from private. Brownfield apps should be able to setup the JSResolutionAlgorithm before hand. Pull Request resolved: https://github.com/facebook/react-native/pull/36715 Reviewed By: cortinico Differential Revision: D44535444 Pulled By: javache fbshipit-source-id: ae91e50de10c993c80ed4bba6f2fece64af178c4
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e5dd9cdc66
commit
cb376dd0d8
+6
-5
@@ -69,7 +69,7 @@ public class ReactInstanceManagerBuilder {
|
||||
private @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder;
|
||||
private @Nullable SurfaceDelegateFactory mSurfaceDelegateFactory;
|
||||
private @Nullable DevLoadingViewManager mDevLoadingViewManager;
|
||||
private JSEngineResolutionAlgorithm jsEngineResolutionAlgorithm = null;
|
||||
private @Nullable JSEngineResolutionAlgorithm mJSEngineResolutionAlgorithm = null;
|
||||
|
||||
/* package protected */ ReactInstanceManagerBuilder() {}
|
||||
|
||||
@@ -126,9 +126,10 @@ public class ReactInstanceManagerBuilder {
|
||||
* Sets the JS Engine to load as either Hermes or JSC. If not set, the default is JSC with a
|
||||
* Hermes fallback.
|
||||
*/
|
||||
private void setJSEngineResolutionAlgorithm(
|
||||
public ReactInstanceManagerBuilder setJSEngineResolutionAlgorithm(
|
||||
@Nullable JSEngineResolutionAlgorithm jsEngineResolutionAlgorithm) {
|
||||
this.jsEngineResolutionAlgorithm = jsEngineResolutionAlgorithm;
|
||||
mJSEngineResolutionAlgorithm = jsEngineResolutionAlgorithm;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -362,7 +363,7 @@ public class ReactInstanceManagerBuilder {
|
||||
|
||||
// if nothing is specified, use old loading method
|
||||
// else load the required engine
|
||||
if (jsEngineResolutionAlgorithm == null) {
|
||||
if (mJSEngineResolutionAlgorithm == null) {
|
||||
FLog.w(
|
||||
TAG,
|
||||
"You're not setting the JS Engine Resolution Algorithm. "
|
||||
@@ -379,7 +380,7 @@ public class ReactInstanceManagerBuilder {
|
||||
HermesExecutor.loadLibrary();
|
||||
return new HermesExecutorFactory();
|
||||
}
|
||||
} else if (jsEngineResolutionAlgorithm == JSEngineResolutionAlgorithm.HERMES) {
|
||||
} else if (mJSEngineResolutionAlgorithm == JSEngineResolutionAlgorithm.HERMES) {
|
||||
HermesExecutor.loadLibrary();
|
||||
return new HermesExecutorFactory();
|
||||
} else {
|
||||
|
||||
+2
-1
@@ -81,7 +81,8 @@ public abstract class ReactNativeHost {
|
||||
.setJSIModulesPackage(getJSIModulePackage())
|
||||
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE)
|
||||
.setReactPackageTurboModuleManagerDelegateBuilder(
|
||||
getReactPackageTurboModuleManagerDelegateBuilder());
|
||||
getReactPackageTurboModuleManagerDelegateBuilder())
|
||||
.setJSEngineResolutionAlgorithm(getJSEngineResolutionAlgorithm());
|
||||
|
||||
for (ReactPackage reactPackage : getPackages()) {
|
||||
builder.addPackage(reactPackage);
|
||||
|
||||
Reference in New Issue
Block a user