mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Allow installing JS binding via the RN Android bridge
Reviewed By: fkgozali Differential Revision: D6979072 fbshipit-source-id: 8b4ac3769496a6a6fe3dd9ee2aac64b66604c413
This commit is contained in:
committed by
Facebook Github Bot
parent
ecc08adf49
commit
db391a500c
@@ -100,7 +100,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
final JavaScriptExecutor jsExecutor,
|
||||
final NativeModuleRegistry nativeModuleRegistry,
|
||||
final JSBundleLoader jsBundleLoader,
|
||||
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler) {
|
||||
NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler,
|
||||
final BridgeListener bridgeListener) {
|
||||
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge.");
|
||||
mHybridData = initHybrid();
|
||||
|
||||
@@ -126,6 +127,9 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
Log.d(ReactConstants.TAG, "Initializing React Xplat Bridge after initializeBridge");
|
||||
|
||||
mJavaScriptContextHolder = new JavaScriptContextHolder(getJavaScriptContext());
|
||||
if (bridgeListener != null) {
|
||||
bridgeListener.onBridgeStarted(this);
|
||||
}
|
||||
}
|
||||
|
||||
private static class BridgeCallback implements ReactCallback {
|
||||
@@ -134,8 +138,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
// and determine there's an inaccessible cycle.
|
||||
private final WeakReference<CatalystInstanceImpl> mOuter;
|
||||
|
||||
public BridgeCallback(CatalystInstanceImpl outer) {
|
||||
mOuter = new WeakReference<CatalystInstanceImpl>(outer);
|
||||
BridgeCallback(CatalystInstanceImpl outer) {
|
||||
mOuter = new WeakReference<>(outer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -553,6 +557,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
private @Nullable NativeModuleRegistry mRegistry;
|
||||
private @Nullable JavaScriptExecutor mJSExecutor;
|
||||
private @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
||||
private @Nullable BridgeListener mBridgeListener;
|
||||
|
||||
|
||||
public Builder setReactQueueConfigurationSpec(
|
||||
ReactQueueConfigurationSpec ReactQueueConfigurationSpec) {
|
||||
@@ -581,13 +587,20 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setBridgeListener(
|
||||
BridgeListener listener) {
|
||||
mBridgeListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CatalystInstanceImpl build() {
|
||||
return new CatalystInstanceImpl(
|
||||
Assertions.assertNotNull(mReactQueueConfigurationSpec),
|
||||
Assertions.assertNotNull(mJSExecutor),
|
||||
Assertions.assertNotNull(mRegistry),
|
||||
Assertions.assertNotNull(mJSBundleLoader),
|
||||
Assertions.assertNotNull(mNativeModuleCallExceptionHandler));
|
||||
Assertions.assertNotNull(mNativeModuleCallExceptionHandler),
|
||||
mBridgeListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user