Skip to content

Commit

Permalink
Expose native pointer thru an interface function for YogaConfig
Browse files Browse the repository at this point in the history
Summary:
Expose native pointer thru an interface function for YogaConfig (its package private to `com.facebook.yoga` namespace),
This way we can make later on YogaConfig a pure abstract class.

Plus, it makes sure external users don't modify the pointer

Reviewed By: SidharthGuglani

Differential Revision: D17266401

fbshipit-source-id: f39b488cea0b73bc3578bb3aa90ab00139bf9271
  • Loading branch information
amir-shalem authored and facebook-github-bot committed Sep 17, 2019
1 parent 393b5f2 commit 487ff2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class YogaConfig {

public static int SPACING_TYPE = 1;

long mNativePointer;
private long mNativePointer;
private YogaLogger mLogger;
private YogaNodeCloneFunction mYogaNodeCloneFunction;

Expand Down Expand Up @@ -76,4 +76,8 @@ public void setLogger(YogaLogger logger) {
public YogaLogger getLogger() {
return mLogger;
}

long getNativePointer() {
return mNativePointer;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private YogaNodeJNIBase(long nativePointer) {
}

YogaNodeJNIBase(YogaConfig config) {
this(YogaNative.jni_YGNodeNewWithConfig(config.mNativePointer));
this(YogaNative.jni_YGNodeNewWithConfig(config.getNativePointer()));
}

public void reset() {
Expand Down

0 comments on commit 487ff2a

Please sign in to comment.