Create CXX Binding

Summary: This diff creates the C++ base classes for Fabric and it integrates them into the starting process of Fabric inside Catalyst App

Reviewed By: shergin

Differential Revision: D8878123

fbshipit-source-id: ce41ad6addfdfb58e602b2dbafebd8f05847e69f
This commit is contained in:
David Vacca 2018-08-15 17:49:15 -07:00 committed by Facebook Github Bot
parent f71c6b6feb
commit fd29878a8b
4 changed files with 21 additions and 3 deletions

View File

@ -0,0 +1,14 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.fabric;
public interface FabricBinder {
void setBinding(FabricBinding binding);
}

View File

@ -9,10 +9,11 @@ package com.facebook.react.fabric;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.NativeMap;
import com.facebook.react.bridge.UIManager;
public interface FabricBinding {
void installFabric(JavaScriptContextHolder jsContext, FabricUIManager fabricModule);
void installFabric(JavaScriptContextHolder jsContext, FabricBinder fabricBinder);
void releaseEventTarget(long jsContextNativePointer, long eventTargetPointer);

View File

@ -60,7 +60,7 @@ import javax.annotation.Nullable;
*/
@SuppressWarnings("unused") // used from JNI
@DoNotStrip
public class FabricUIManager implements UIManager, JSHandler {
public class FabricUIManager implements UIManager, JSHandler, FabricBinder {
private static final String TAG = FabricUIManager.class.getSimpleName();
private static final boolean DEBUG = ReactBuildConfig.DEBUG || PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.FABRIC_UI_MANAGER);
@ -98,6 +98,7 @@ public class FabricUIManager implements UIManager, JSHandler {
mJSContext = jsContext;
}
@Override
public void setBinding(FabricBinding binding) {
mBinding = binding;
}

View File

@ -10,6 +10,8 @@ package com.facebook.react.fabric.jsc;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.JavaScriptContextHolder;
import com.facebook.react.bridge.UIManager;
import com.facebook.react.fabric.FabricBinder;
import com.facebook.react.fabric.FabricBinding;
import com.facebook.react.fabric.FabricUIManager;
import com.facebook.react.bridge.NativeMap;
@ -58,7 +60,7 @@ public class FabricJSCBinding implements FabricBinding {
}
@Override
public void installFabric(JavaScriptContextHolder jsContext, FabricUIManager fabricModule) {
public void installFabric(JavaScriptContextHolder jsContext, FabricBinder fabricModule) {
fabricModule.setBinding(this);
installFabric(jsContext.get(), fabricModule);
}