diff --git a/packages/react-native/React/Views/RCTShadowView.m b/packages/react-native/React/Views/RCTShadowView.m index b893cfe5c26785..53c51d2bbdef1c 100644 --- a/packages/react-native/React/Views/RCTShadowView.m +++ b/packages/react-native/React/Views/RCTShadowView.m @@ -63,6 +63,9 @@ + (YGConfigRef)yogaConfig #define RCT_SET_YGVALUE(ygvalue, setter, ...) \ switch (ygvalue.unit) { \ case YGUnitAuto: \ + case YGUnitMaxContent: \ + case YGUnitFitContent: \ + case YGUnitStretch: \ case YGUnitUndefined: \ setter(__VA_ARGS__, YGUndefined); \ break; \ @@ -88,6 +91,35 @@ + (YGConfigRef)yogaConfig case YGUnitPercent: \ setter##Percent(__VA_ARGS__, ygvalue.value); \ break; \ + case YGUnitMaxContent: \ + case YGUnitFitContent: \ + case YGUnitStretch: \ + break; \ + } + +#define RCT_SET_YGVALUE_AUTO_INTRINSIC(ygvalue, setter, ...) \ + switch (ygvalue.unit) { \ + case YGUnitAuto: \ + setter##Auto(__VA_ARGS__); \ + break; \ + case YGUnitMaxContent: \ + setter##MaxContent(__VA_ARGS__); \ + break; \ + case YGUnitFitContent: \ + setter##FitContent(__VA_ARGS__); \ + break; \ + case YGUnitStretch: \ + setter##Stretch(__VA_ARGS__); \ + break; \ + case YGUnitUndefined: \ + setter(__VA_ARGS__, YGUndefined); \ + break; \ + case YGUnitPoint: \ + setter(__VA_ARGS__, ygvalue.value); \ + break; \ + case YGUnitPercent: \ + setter##Percent(__VA_ARGS__, ygvalue.value); \ + break; \ } static void RCTProcessMetaPropsPadding(const YGValue metaProps[META_PROP_COUNT], YGNodeRef node) @@ -483,14 +515,14 @@ -(float)border##prop##Width \ RCT_BORDER_PROPERTY(End, END) // Dimensions -#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ - -(void)set##setProp : (YGValue)value \ - { \ - RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSet##cssProp, _yogaNode); \ - } \ - -(YGValue)getProp \ - { \ - return YGNodeStyleGet##cssProp(_yogaNode); \ +#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ + -(void)set##setProp : (YGValue)value \ + { \ + RCT_SET_YGVALUE_AUTO_INTRINSIC(value, YGNodeStyleSet##cssProp, _yogaNode); \ + } \ + -(YGValue)getProp \ + { \ + return YGNodeStyleGet##cssProp(_yogaNode); \ } #define RCT_MIN_MAX_DIMENSION_PROPERTY(setProp, getProp, cssProp) \ @@ -634,7 +666,7 @@ - (void)setLocalData:(__unused NSObject *)localData - (void)setFlexBasis:(YGValue)value { - RCT_SET_YGVALUE_AUTO(value, YGNodeStyleSetFlexBasis, _yogaNode); + RCT_SET_YGVALUE_AUTO_INTRINSIC(value, YGNodeStyleSetFlexBasis, _yogaNode); } - (YGValue)flexBasis diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java index 89ef5ef16f536f..582bd1eb19efd7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java @@ -74,6 +74,9 @@ public class YogaNative { static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis); static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer); + static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge); static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin); static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent); @@ -91,22 +94,40 @@ public class YogaNative { static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width); static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer); + static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height); static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent); static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer); + static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer); static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth); static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent); + static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight); static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent); + static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer); static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth); static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent); + static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer); static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer); static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight); static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent); + static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer); + static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer); static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer); static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio); static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java index ba076846759607..b683b553ca4e8f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java @@ -124,6 +124,12 @@ public interface Inputs { public abstract void setFlexBasisAuto(); + public abstract void setFlexBasisMaxContent(); + + public abstract void setFlexBasisFitContent(); + + public abstract void setFlexBasisStretch(); + public abstract YogaValue getMargin(YogaEdge edge); public abstract void setMargin(YogaEdge edge, float margin); @@ -158,6 +164,12 @@ public interface Inputs { public abstract void setWidthAuto(); + public abstract void setWidthMaxContent(); + + public abstract void setWidthFitContent(); + + public abstract void setWidthStretch(); + public abstract YogaValue getHeight(); public abstract void setHeight(float height); @@ -166,30 +178,60 @@ public interface Inputs { public abstract void setHeightAuto(); + public abstract void setHeightMaxContent(); + + public abstract void setHeightFitContent(); + + public abstract void setHeightStretch(); + public abstract YogaValue getMinWidth(); public abstract void setMinWidth(float minWidth); public abstract void setMinWidthPercent(float percent); + public abstract void setMinWidthMaxContent(); + + public abstract void setMinWidthFitContent(); + + public abstract void setMinWidthStretch(); + public abstract YogaValue getMinHeight(); public abstract void setMinHeight(float minHeight); public abstract void setMinHeightPercent(float percent); + public abstract void setMinHeightMaxContent(); + + public abstract void setMinHeightFitContent(); + + public abstract void setMinHeightStretch(); + public abstract YogaValue getMaxWidth(); public abstract void setMaxWidth(float maxWidth); public abstract void setMaxWidthPercent(float percent); + public abstract void setMaxWidthMaxContent(); + + public abstract void setMaxWidthFitContent(); + + public abstract void setMaxWidthStretch(); + public abstract YogaValue getMaxHeight(); public abstract void setMaxHeight(float maxheight); public abstract void setMaxHeightPercent(float percent); + public abstract void setMaxHeightMaxContent(); + + public abstract void setMaxHeightFitContent(); + + public abstract void setMaxHeightStretch(); + public abstract float getAspectRatio(); public abstract void setAspectRatio(float aspectRatio); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java index a53fe74af00241..e25872545e4913 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java @@ -373,6 +373,18 @@ public void setFlexBasisAuto() { YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer); } + public void setFlexBasisMaxContent() { + YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer); + } + + public void setFlexBasisFitContent() { + YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer); + } + + public void setFlexBasisStretch() { + YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer); + } + public YogaValue getMargin(YogaEdge edge) { return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue())); } @@ -441,6 +453,18 @@ public void setWidthAuto() { YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer); } + public void setWidthMaxContent() { + YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer); + } + + public void setWidthFitContent() { + YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer); + } + + public void setWidthStretch() { + YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer); + } + public YogaValue getHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer)); } @@ -457,6 +481,18 @@ public void setHeightAuto() { YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer); } + public void setHeightMaxContent() { + YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer); + } + + public void setHeightFitContent() { + YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer); + } + + public void setHeightStretch() { + YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer); + } + public YogaValue getMinWidth() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer)); } @@ -469,6 +505,18 @@ public void setMinWidthPercent(float percent) { YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent); } + public void setMinWidthMaxContent() { + YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer); + } + + public void setMinWidthFitContent() { + YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer); + } + + public void setMinWidthStretch() { + YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer); + } + public YogaValue getMinHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer)); } @@ -481,6 +529,18 @@ public void setMinHeightPercent(float percent) { YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent); } + public void setMinHeightMaxContent() { + YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer); + } + + public void setMinHeightFitContent() { + YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer); + } + + public void setMinHeightStretch() { + YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer); + } + public YogaValue getMaxWidth() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer)); } @@ -493,6 +553,18 @@ public void setMaxWidthPercent(float percent) { YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent); } + public void setMaxWidthMaxContent() { + YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer); + } + + public void setMaxWidthFitContent() { + YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer); + } + + public void setMaxWidthStretch() { + YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer); + } + public YogaValue getMaxHeight() { return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer)); } @@ -505,6 +577,18 @@ public void setMaxHeightPercent(float percent) { YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent); } + public void setMaxHeightMaxContent() { + YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer); + } + + public void setMaxHeightFitContent() { + YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer); + } + + public void setMaxHeightStretch() { + YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer); + } + public float getAspectRatio() { return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java index c596c6a7c1c817..0cad45fa9cc311 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java @@ -15,15 +15,33 @@ public interface YogaProps { void setWidthPercent(float percent); + void setWidthAuto(); + + void setWidthMaxContent(); + + void setWidthFitContent(); + + void setWidthStretch(); + void setMinWidth(float minWidth); void setMinWidthPercent(float percent); + void setMinWidthMaxContent(); + + void setMinWidthFitContent(); + + void setMinWidthStretch(); + void setMaxWidth(float maxWidth); void setMaxWidthPercent(float percent); - void setWidthAuto(); + void setMaxWidthMaxContent(); + + void setMaxWidthFitContent(); + + void setMaxWidthStretch(); /* Height properties */ @@ -31,15 +49,33 @@ public interface YogaProps { void setHeightPercent(float percent); + void setHeightAuto(); + + void setHeightMaxContent(); + + void setHeightFitContent(); + + void setHeightStretch(); + void setMinHeight(float minHeight); void setMinHeightPercent(float percent); + void setMinHeightMaxContent(); + + void setMinHeightFitContent(); + + void setMinHeightStretch(); + void setMaxHeight(float maxHeight); void setMaxHeightPercent(float percent); - void setHeightAuto(); + void setMaxHeightMaxContent(); + + void setMaxHeightFitContent(); + + void setMaxHeightStretch(); /* Margin properties */ @@ -81,6 +117,12 @@ public interface YogaProps { void setFlexBasis(float flexBasis); + void setFlexBasisMaxContent(); + + void setFlexBasisFitContent(); + + void setFlexBasisStretch(); + void setFlexDirection(YogaFlexDirection direction); void setFlexGrow(float flexGrow); diff --git a/packages/react-native/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp b/packages/react-native/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp index 6b8ed14bd694f7..95273836c22bd1 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp @@ -429,6 +429,28 @@ static void jni_YGNodeCopyStyleJNI( YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \ } +#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \ + YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \ + YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) + +#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \ + YG_NODE_JNI_STYLE_UNIT_PROP(name) \ + YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) + +#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \ + static void jni_YGNodeStyleSet##name##MaxContentJNI( \ + JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ + YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \ + } \ + static void jni_YGNodeStyleSet##name##FitContentJNI( \ + JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ + YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \ + } \ + static void jni_YGNodeStyleSet##name##StretchJNI( \ + JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \ + YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \ + } + #define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \ static jlong jni_YGNodeStyleGet##name##JNI( \ JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \ @@ -483,13 +505,13 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex); YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow); YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width); -YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth); -YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth); -YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height); -YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight); -YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width); +YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth); +YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth); +YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height); +YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight); +YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight); YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position); @@ -870,6 +892,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetFlexBasisAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetFlexBasisAutoJNI}, + {"jni_YGNodeStyleSetFlexBasisMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI}, + {"jni_YGNodeStyleSetFlexBasisFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetFlexBasisFitContentJNI}, + {"jni_YGNodeStyleSetFlexBasisStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetFlexBasisStretchJNI}, {"jni_YGNodeStyleGetMarginJNI", "(JI)J", (void*)jni_YGNodeStyleGetMarginJNI}, @@ -917,6 +948,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetWidthAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetWidthAutoJNI}, + {"jni_YGNodeStyleSetWidthMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetWidthMaxContentJNI}, + {"jni_YGNodeStyleSetWidthFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetWidthFitContentJNI}, + {"jni_YGNodeStyleSetWidthStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetWidthStretchJNI}, {"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI}, {"jni_YGNodeStyleSetHeightJNI", "(JF)V", @@ -927,6 +967,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetHeightAutoJNI", "(J)V", (void*)jni_YGNodeStyleSetHeightAutoJNI}, + {"jni_YGNodeStyleSetHeightMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetHeightMaxContentJNI}, + {"jni_YGNodeStyleSetHeightFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetHeightFitContentJNI}, + {"jni_YGNodeStyleSetHeightStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetHeightStretchJNI}, {"jni_YGNodeStyleGetMinWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetMinWidthJNI}, @@ -936,6 +985,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMinWidthPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinWidthPercentJNI}, + {"jni_YGNodeStyleSetMinWidthMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinWidthMaxContentJNI}, + {"jni_YGNodeStyleSetMinWidthFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinWidthFitContentJNI}, + {"jni_YGNodeStyleSetMinWidthStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinWidthStretchJNI}, {"jni_YGNodeStyleGetMinHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetMinHeightJNI}, @@ -945,6 +1003,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMinHeightPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMinHeightPercentJNI}, + {"jni_YGNodeStyleSetMinHeightMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinHeightMaxContentJNI}, + {"jni_YGNodeStyleSetMinHeightFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinHeightFitContentJNI}, + {"jni_YGNodeStyleSetMinHeightStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMinHeightStretchJNI}, {"jni_YGNodeStyleGetMaxWidthJNI", "(J)J", (void*)jni_YGNodeStyleGetMaxWidthJNI}, @@ -954,6 +1021,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMaxWidthPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxWidthPercentJNI}, + {"jni_YGNodeStyleSetMaxWidthMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI}, + {"jni_YGNodeStyleSetMaxWidthFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxWidthFitContentJNI}, + {"jni_YGNodeStyleSetMaxWidthStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxWidthStretchJNI}, {"jni_YGNodeStyleGetMaxHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetMaxHeightJNI}, @@ -963,6 +1039,15 @@ static JNINativeMethod methods[] = { {"jni_YGNodeStyleSetMaxHeightPercentJNI", "(JF)V", (void*)jni_YGNodeStyleSetMaxHeightPercentJNI}, + {"jni_YGNodeStyleSetMaxHeightMaxContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI}, + {"jni_YGNodeStyleSetMaxHeightFitContentJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxHeightFitContentJNI}, + {"jni_YGNodeStyleSetMaxHeightStretchJNI", + "(J)V", + (void*)jni_YGNodeStyleSetMaxHeightStretchJNI}, {"jni_YGNodeStyleGetAspectRatioJNI", "(J)F", (void*)jni_YGNodeStyleGetAspectRatioJNI}, diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.cpp b/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.cpp index 1f110a9edbd057..2c9ad3199717ac 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.cpp +++ b/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.cpp @@ -192,6 +192,21 @@ void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) { node, StyleSizeValue::ofAuto()); } +void YGNodeStyleSetFlexBasisMaxContent(const YGNodeRef node) { + updateStyle<&Style::flexBasis, &Style::setFlexBasis>( + node, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetFlexBasisFitContent(const YGNodeRef node) { + updateStyle<&Style::flexBasis, &Style::setFlexBasis>( + node, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetFlexBasisStretch(const YGNodeRef node) { + updateStyle<&Style::flexBasis, &Style::setFlexBasis>( + node, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().flexBasis(); } @@ -321,6 +336,21 @@ void YGNodeStyleSetWidthAuto(YGNodeRef node) { node, Dimension::Width, StyleSizeValue::ofAuto()); } +void YGNodeStyleSetWidthMaxContent(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Width, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetWidthFitContent(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Width, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetWidthStretch(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Width, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetWidth(YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().dimension(Dimension::Width); } @@ -340,6 +370,21 @@ void YGNodeStyleSetHeightAuto(YGNodeRef node) { node, Dimension::Height, StyleSizeValue::ofAuto()); } +void YGNodeStyleSetHeightMaxContent(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Height, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetHeightFitContent(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Height, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetHeightStretch(YGNodeRef node) { + updateStyle<&Style::dimension, &Style::setDimension>( + node, Dimension::Height, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetHeight(YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().dimension(Dimension::Height); } @@ -354,6 +399,21 @@ void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) { node, Dimension::Width, StyleSizeValue::percent(minWidth)); } +void YGNodeStyleSetMinWidthMaxContent(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Width, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetMinWidthFitContent(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Width, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetMinWidthStretch(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Width, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().minDimension(Dimension::Width); } @@ -370,6 +430,21 @@ void YGNodeStyleSetMinHeightPercent( node, Dimension::Height, StyleSizeValue::percent(minHeight)); } +void YGNodeStyleSetMinHeightMaxContent(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Height, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetMinHeightFitContent(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Height, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetMinHeightStretch(const YGNodeRef node) { + updateStyle<&Style::minDimension, &Style::setMinDimension>( + node, Dimension::Height, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().minDimension(Dimension::Height); } @@ -384,6 +459,21 @@ void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) { node, Dimension::Width, StyleSizeValue::percent(maxWidth)); } +void YGNodeStyleSetMaxWidthMaxContent(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Width, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetMaxWidthFitContent(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Width, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetMaxWidthStretch(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Width, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().maxDimension(Dimension::Width); } @@ -400,6 +490,21 @@ void YGNodeStyleSetMaxHeightPercent( node, Dimension::Height, StyleSizeValue::percent(maxHeight)); } +void YGNodeStyleSetMaxHeightMaxContent(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Height, StyleSizeValue::ofMaxContent()); +} + +void YGNodeStyleSetMaxHeightFitContent(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Height, StyleSizeValue::ofFitContent()); +} + +void YGNodeStyleSetMaxHeightStretch(const YGNodeRef node) { + updateStyle<&Style::maxDimension, &Style::setMaxDimension>( + node, Dimension::Height, StyleSizeValue::ofStretch()); +} + YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) { return (YGValue)resolveRef(node)->style().maxDimension(Dimension::Height); } diff --git a/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.h b/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.h index 2746a4a00abb98..a971138bb9dc8a 100644 --- a/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.h +++ b/packages/react-native/ReactCommon/yoga/yoga/YGNodeStyle.h @@ -64,6 +64,9 @@ YG_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis); YG_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis); YG_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetFlexBasisMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetFlexBasisFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetFlexBasisStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node); YG_EXPORT void @@ -101,27 +104,45 @@ YG_EXPORT YGBoxSizing YGNodeStyleGetBoxSizing(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width); YG_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width); YG_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetWidthMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetWidthFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height); YG_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height); YG_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetHeightMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetHeightFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth); YG_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth); +YG_EXPORT void YGNodeStyleSetMinWidthMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMinWidthFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMinWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight); YG_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight); +YG_EXPORT void YGNodeStyleSetMinHeightMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMinHeightFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMinHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth); YG_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth); +YG_EXPORT void YGNodeStyleSetMaxWidthMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMaxWidthFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMaxWidthStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight); YG_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight); +YG_EXPORT void YGNodeStyleSetMaxHeightMaxContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMaxHeightFitContent(YGNodeRef node); +YG_EXPORT void YGNodeStyleSetMaxHeightStretch(YGNodeRef node); YG_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node); YG_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);