Skip to content

Commit

Permalink
Enable Venice
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Lulu Wu authored and facebook-github-bot committed Mar 9, 2023
1 parent ad7bf51 commit e26092a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public ReactActivityDelegate(ReactActivity activity, @Nullable String mainCompon
return null;
}

private @NonNull Bundle composeLaunchOptions() {
protected @NonNull Bundle composeLaunchOptions() {
Bundle composedLaunchOptions = getLaunchOptions();
if (isFabricEnabled()) {
if (composedLaunchOptions == null) {
Expand All @@ -71,6 +71,10 @@ protected ReactRootView createRootView() {
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
Expand Down Expand Up @@ -98,7 +102,7 @@ protected void onCreate(Bundle savedInstanceState) {
getPlainActivity(), getReactNativeHost(), mainComponentName, launchOptions) {
@Override
protected ReactRootView createRootView() {
return ReactActivityDelegate.this.createRootView();
return ReactActivityDelegate.this.createRootView(launchOptions);
}
};
if (mainComponentName != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,10 @@ public boolean isBridgeless() {
* 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ static void install(final ReactContext reactContext, final BlobModule blobModule
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());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ public void hide() {
new Runnable() {
@Override
public void run() {
mDevLoadingViewManager.hide();
if (mDevLoadingViewManager != null) {
mDevLoadingViewManager.hide();
}
}
});
}
Expand Down

0 comments on commit e26092a

Please sign in to comment.