Enable Venice

Summary:
Make Venice available in Catalyst Android, to enable set ```ReactFeatureFlags.enableBridgelessArchitecture``` to true in CatalystApplication.java

**Note**: right now not every piece works with Venice enabled, but the main functionalities (Fabric components, playground) mostly work, the rest issues will be gradually fixed.

Changelog:
[Internal][Changed] - Enable Venice in Catalyst Android

Reviewed By: NickGerleman

Differential Revision: D43711737

fbshipit-source-id: 6ecb7e2b09c5b7feaa00b90076a2a894c08affc9
This commit is contained in:
Lulu Wu
2023-03-09 15:10:00 -08:00
committed by Facebook GitHub Bot
parent ad7bf51b7b
commit e26092aec3
4 changed files with 14 additions and 5 deletions
@@ -56,7 +56,7 @@ public class ReactActivityDelegate {
return null;
}
private @NonNull Bundle composeLaunchOptions() {
protected @NonNull Bundle composeLaunchOptions() {
Bundle composedLaunchOptions = getLaunchOptions();
if (isFabricEnabled()) {
if (composedLaunchOptions == null) {
@@ -71,6 +71,10 @@ public class ReactActivityDelegate {
return new ReactRootView(getContext());
}
protected ReactRootView createRootView(Bundle initialProps) {
return new ReactRootView(getContext());
}
/**
* Get the {@link ReactNativeHost} used by this app. By default, assumes {@link
* Activity#getApplication()} is an instance of {@link ReactApplication} and calls {@link
@@ -98,7 +102,7 @@ public class ReactActivityDelegate {
getPlainActivity(), getReactNativeHost(), mainComponentName, launchOptions) {
@Override
protected ReactRootView createRootView() {
return ReactActivityDelegate.this.createRootView();
return ReactActivityDelegate.this.createRootView(launchOptions);
}
};
if (mainComponentName != null) {
@@ -511,7 +511,10 @@ public class ReactContext extends ContextWrapper {
* synchronized(jsContext) { nativeThingNeedingJsContext(jsContext.get()); }
*/
public JavaScriptContextHolder getJavaScriptContextHolder() {
return mCatalystInstance.getJavaScriptContextHolder();
if (mCatalystInstance != null) {
return mCatalystInstance.getJavaScriptContextHolder();
}
return null;
}
public @Nullable JSIModule getJSIModule(JSIModuleType moduleType) {
@@ -23,7 +23,7 @@ import com.facebook.soloader.SoLoader;
public void run() {
JavaScriptContextHolder jsContext = reactContext.getJavaScriptContextHolder();
// When debugging in chrome the JS context is not available.
if (jsContext.get() != 0) {
if (jsContext != null && jsContext.get() != 0) {
nativeInstall(blobModule, jsContext.get());
}
}
@@ -58,7 +58,9 @@ public class DevLoadingModule extends NativeDevLoadingViewSpec {
new Runnable() {
@Override
public void run() {
mDevLoadingViewManager.hide();
if (mDevLoadingViewManager != null) {
mDevLoadingViewManager.hide();
}
}
});
}