Add InstanceHandle parameter into FabricJSC/JSI

Reviewed By: achen1

Differential Revision: D7644487

fbshipit-source-id: b49381a58a791043bf61b8ac5f065817caff7c95
This commit is contained in:
David Vacca
2018-04-24 12:37:08 -07:00
committed by Facebook Github Bot
parent 16a5324ca6
commit f44e78df55
3 changed files with 17 additions and 14 deletions

View File

@@ -67,7 +67,7 @@ public class FabricUIManager implements UIManager {
/** Creates a new {@link ReactShadowNode} */
@Nullable
public ReactShadowNode createNode(
int reactTag, String viewName, int rootTag, ReadableNativeMap props) {
int reactTag, String viewName, int rootTag, ReadableNativeMap props, int instanceHandle) {
if (DEBUG) {
Log.d(TAG, "createNode \n\ttag: " + reactTag +
"\n\tviewName: " + viewName +

View File

@@ -83,17 +83,16 @@ JSValueRef createNode(JSContextRef ctx, JSObjectRef function, JSObjectRef thisOb
static auto createNode =
jni::findClassStatic("com/facebook/react/fabric/FabricUIManager")
->getMethod<alias_ref<JShadowNode>(jint, jstring, jint, ReadableNativeMap::javaobject)>("createNode");
->getMethod<alias_ref<JShadowNode>(jint, jstring, jint, ReadableNativeMap::javaobject, jint)>("createNode");
int reactTag = (int)JSC_JSValueToNumber(ctx, arguments[0], NULL);
auto viewName = JSValueToJString(ctx, arguments[1]);
int rootTag = (int)JSC_JSValueToNumber(ctx, arguments[2], NULL);
auto props = JSC_JSValueIsNull(ctx, arguments[3]) ? local_ref<ReadableNativeMap::jhybridobject>(nullptr) :
JSValueToReadableMapViaJSON(ctx, arguments[3]);;
int instanceHandle = (int)JSC_JSValueToNumber(ctx, arguments[4], NULL);
// TODO: Retain object in arguments[4] using a weak ref.
auto node = createNode(manager, reactTag, viewName.get(), rootTag, props.get());
auto node = createNode(manager, reactTag, viewName.get(), rootTag, props.get(), instanceHandle);
return JSC_JSObjectMake(ctx, classRef, makePlainGlobalRef(node.get()));
}