Avoid cleaning up Owner of YGNode during clonning
Summary: This diff refactors the cloning mechanism for YogaNode used from Fabric UI renderer and RN iOS graphs. Previously, we were cleaning the owner of the child's cloned node inside the C++ implementation of YogaNode. This was a mistake because this modified the last commited YogaTree, causing side effect in RN iOS graphs. Reviewed By: shergin Differential Revision: D8672627 fbshipit-source-id: c9902d00690e0361fd58aed84b506c42258bd995
This commit is contained in:
committed by
Facebook Github Bot
parent
77ea79490f
commit
f4d29e6f11
@@ -268,6 +268,16 @@ jlong jni_YGNodeNewWithConfig(alias_ref<jobject> thiz, jlong configPointer) {
|
||||
return reinterpret_cast<jlong>(node);
|
||||
}
|
||||
|
||||
void jni_YGNodeSetOwner(
|
||||
alias_ref<jobject> thiz,
|
||||
jlong nativePointer,
|
||||
jlong newOwnerNativePointer) {
|
||||
const YGNodeRef node = _jlong2YGNodeRef(nativePointer);
|
||||
const YGNodeRef newOwnerNode = _jlong2YGNodeRef(newOwnerNativePointer);
|
||||
|
||||
node->setOwner(newOwnerNode);
|
||||
}
|
||||
|
||||
jlong jni_YGNodeClone(
|
||||
alias_ref<jobject> thiz,
|
||||
jlong nativePointer,
|
||||
@@ -667,6 +677,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
||||
YGMakeNativeMethod(jni_YGNodePrint),
|
||||
YGMakeNativeMethod(jni_YGNodeClone),
|
||||
YGMakeNativeMethod(jni_YGNodeSetOwner),
|
||||
});
|
||||
registerNatives(
|
||||
"com/facebook/yoga/YogaConfig",
|
||||
|
Reference in New Issue
Block a user