mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-23 03:50:11 +08:00
Add aspectRatio style property
Reviewed By: gkassabli Differential Revision: D4211458 fbshipit-source-id: f8d0d318369c7b529ee29e61a52b17d0cf3b396d
This commit is contained in:
committed by
Facebook Github Bot
parent
ec467fbd34
commit
e1df3c8782
@@ -476,6 +476,16 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
|
||||
jni_CSSNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||
}
|
||||
|
||||
private native float jni_CSSNodeStyleGetAspectRatio(long nativePointer);
|
||||
public float getStyleAspectRatio() {
|
||||
return jni_CSSNodeStyleGetAspectRatio(mNativePointer);
|
||||
}
|
||||
|
||||
private native void jni_CSSNodeStyleSetAspectRatio(long nativePointer, float aspectRatio);
|
||||
public void setStyleAspectRatio(float aspectRatio) {
|
||||
jni_CSSNodeStyleSetAspectRatio(mNativePointer, aspectRatio);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLayoutX() {
|
||||
return mLeft;
|
||||
|
||||
@@ -249,6 +249,9 @@ CSS_NODE_JNI_STYLE_PROP(jfloat, float, Height);
|
||||
CSS_NODE_JNI_STYLE_PROP(jfloat, float, MinHeight);
|
||||
CSS_NODE_JNI_STYLE_PROP(jfloat, float, MaxHeight);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
CSS_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
|
||||
|
||||
#define CSSMakeNativeMethod(name) makeNativeMethod(#name, name)
|
||||
|
||||
jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||
@@ -312,6 +315,8 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||
CSSMakeNativeMethod(jni_CSSNodeStyleSetMaxWidth),
|
||||
CSSMakeNativeMethod(jni_CSSNodeStyleGetMaxHeight),
|
||||
CSSMakeNativeMethod(jni_CSSNodeStyleSetMaxHeight),
|
||||
CSSMakeNativeMethod(jni_CSSNodeStyleGetAspectRatio),
|
||||
CSSMakeNativeMethod(jni_CSSNodeStyleSetAspectRatio),
|
||||
|
||||
CSSMakeNativeMethod(jni_CSSNodeGetInstanceCount),
|
||||
CSSMakeNativeMethod(jni_CSSLayoutSetLogger),
|
||||
|
||||
Reference in New Issue
Block a user