From c82b9f72de8b63b5c7c2c2271c5e3c53072d3ce9 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 15 Feb 2018 12:04:46 -0800 Subject: [PATCH] Create JNI wrapper for Fabric Reviewed By: fkgozali Differential Revision: D6989838 fbshipit-source-id: f092901cacc0c3eb89b08c6ac0384c4d5f6e6cfe --- .../java/com/facebook/react/ReactInstanceManager.java | 9 +++++++-- .../src/main/java/com/facebook/react/fabric/BUCK | 10 ---------- .../java/com/facebook/react/fabric/FabricBinding.java | 7 +++++++ 3 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index 834fa4acb9b..71844e945a8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -352,12 +352,17 @@ public class ReactInstanceManager { Assertions.assertNotNull(catalystInstance, "CatalystInstance null after hasStartedCreatingInitialContext true."); - final ReactApplicationContext reactContext = new ReactApplicationContext(mApplicationContext); + final ReactApplicationContext reactContext = getReactApplicationContext(); NativeModuleRegistry nativeModuleRegistry = processPackages(reactContext, packages, true); catalystInstance.extendNativeModules(nativeModuleRegistry); } + @VisibleForTesting + public @Nullable ReactApplicationContext getReactApplicationContext() { + return new ReactApplicationContext(mApplicationContext); + } + /** * Recreate the react application and context. This should be called if configuration has changed * or the developer has requested the app to be reloaded. It should only be called after an @@ -1088,7 +1093,7 @@ public class ReactInstanceManager { JSBundleLoader jsBundleLoader) { Log.d(ReactConstants.TAG, "ReactInstanceManager.createReactContext()"); ReactMarker.logMarker(CREATE_REACT_CONTEXT_START); - final ReactApplicationContext reactContext = new ReactApplicationContext(mApplicationContext); + final ReactApplicationContext reactContext = getReactApplicationContext(); if (mUseDeveloperSupport) { reactContext.setNativeModuleCallExceptionHandler(mDevSupportManager); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK index bc7ab5bbebc..3ff8cc422df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/BUCK @@ -11,20 +11,10 @@ android_library( "PUBLIC", ], deps = [ - react_native_dep("libraries/fbcore/src/main/java/com/facebook/common/logging:logging"), - react_native_dep("libraries/fresco/fresco-react-native:fbcore"), - react_native_dep("libraries/fresco/fresco-react-native:fresco-drawee"), - react_native_dep("libraries/fresco/fresco-react-native:fresco-react-native"), - react_native_dep("libraries/fresco/fresco-react-native:imagepipeline"), - react_native_dep("libraries/textlayoutbuilder:textlayoutbuilder"), react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_target("java/com/facebook/react:reactAndroid"), react_native_target("java/com/facebook/react/bridge:bridgeAndroid"), - react_native_target("java/com/facebook/react/common:commonAndroid"), - react_native_target("java/com/facebook/react/devsupport:devsupportAndroid"), - react_native_target("java/com/facebook/react/modules/core:coreAndroid"), - react_native_target("java/com/facebook/react/shell:shellAndroid"), react_native_target("java/com/facebook/react/uimanager:uimanagerAndroid"), react_native_target("java/com/facebook/react/uimanager/annotations:annotationsAndroid"), react_native_target("java/com/facebook/react/module/annotations:annotationsAndroid"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java new file mode 100644 index 00000000000..a44cf8b1d95 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricBinding.java @@ -0,0 +1,7 @@ +package com.facebook.react.fabric; + +public interface FabricBinding { + + void installFabric(Object jsContext, FabricUIManagerModule fabricModule); + +}