Expose methods of persistent yoga for Java
Summary: This diff extends the JNI version of yoga in order to allow Java instances of the YogaConfig class to receive a callback when a Yoga node is cloned. Reviewed By: priteshrnandgaonkar Differential Revision: D6918605 fbshipit-source-id: e424c78680c04e21154ebe21405671c4e90f6529
This commit is contained in:
committed by
Facebook Github Bot
parent
3ec41b656f
commit
b1222bf83e
@@ -23,6 +23,7 @@ public class YogaConfig {
|
||||
|
||||
long mNativePointer;
|
||||
private YogaLogger mLogger;
|
||||
private YogaNodeClonedFunction mNodeClonedFunction;
|
||||
|
||||
private native long jni_YGConfigNew();
|
||||
public YogaConfig() {
|
||||
@@ -80,4 +81,17 @@ public class YogaConfig {
|
||||
public YogaLogger getLogger() {
|
||||
return mLogger;
|
||||
}
|
||||
|
||||
private native void jni_YGConfigSetHasNodeClonedFunc(long nativePointer, boolean hasClonedFunc);
|
||||
|
||||
public void setOnNodeCloned(YogaNodeClonedFunction nodeClonedFunction) {
|
||||
mNodeClonedFunction = nodeClonedFunction;
|
||||
jni_YGConfigSetHasNodeClonedFunc(mNativePointer, nodeClonedFunction != null);
|
||||
}
|
||||
|
||||
@DoNotStrip
|
||||
public final void onNodeCloned(
|
||||
YogaNode oldNode, YogaNode newNode, YogaNode parent, int childIndex) {
|
||||
mNodeClonedFunction.onNodeCloned(oldNode, newNode, parent, childIndex);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user