Update the template to load the correct JS engine at runtime. (#35095)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35095

This change will make sure that we load the correct JS engine at runtime,
by using the BuildConfig flag that RNGP sets for us.

This will solve a lot of noise in adb logcat for users seeing
stacktraces mentioning failing to load `jscexecutor` library.

This is also a breaking change, but as the API was not widely used nor
advertised in the template, we should be fine by just mentioning this in the release notes.

Changelog:
[Android] [Changed] - Update the template to load the correct JS engine at runtime

Reviewed By: cipolleschi

Differential Revision: D40710597

fbshipit-source-id: d59a7a52b22a9bf273ea89094c6620c3ecf6eb00
This commit is contained in:
Nicola Corti
2022-10-27 04:47:25 -07:00
committed by Facebook GitHub Bot
parent 3f77736e15
commit 2097278d2a
8 changed files with 75 additions and 44 deletions
@@ -190,4 +190,12 @@ public abstract class ReactNativeHost {
* default ones, you'll want to include more packages here.
*/
protected abstract List<ReactPackage> getPackages();
/**
* Returns the {@link JSEngineResolutionAlgorithm} to be used when loading the JS engine. If null,
* will try to load JSC first and fallback to Hermes if JSC is not available.
*/
protected @Nullable JSEngineResolutionAlgorithm getJSEngineResolutionAlgorithm() {
return null;
}
}