Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<86c797c19cc585b74714ca3aa75bbd6d>>
* @generated SignedSource<<7e91da9df64ce42424101d7d72356c4a>>
*/

/**
Expand Down Expand Up @@ -168,6 +168,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableFabricLogs(): Boolean = accessor.enableFabricLogs()

/**
* Enables CSS Flexbox §4.5 automatic minimum sizing under strict layout conformance. When enabled, a flex item with an undefined main-axis `min-width`/`min-height` under strict conformance receives a content-derived minimum size (per spec) instead of an undefined (0) minimum. Defaults off so the behaviour can be ramped independently of strict conformance.
*/
@JvmStatic
public fun enableFlexboxAutoMinSizeInStrictMode(): Boolean = accessor.enableFlexboxAutoMinSizeInStrictMode()

/**
* Enables font scale changes updating layout for measurable nodes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d71556cf1226fe6a41dd388568153d3a>>
* @generated SignedSource<<3c0e10dee93b76f3e66ca79d26f2b4f2>>
*/

/**
Expand Down Expand Up @@ -43,6 +43,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableExclusivePropsUpdateAndroidCache: Boolean? = null
private var enableFabricCommitBranchingCache: Boolean? = null
private var enableFabricLogsCache: Boolean? = null
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -315,6 +316,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean {
var cached = enableFlexboxAutoMinSizeInStrictModeCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableFlexboxAutoMinSizeInStrictMode()
enableFlexboxAutoMinSizeInStrictModeCache = cached
}
return cached
}

override fun enableFontScaleChangesUpdatingLayout(): Boolean {
var cached = enableFontScaleChangesUpdatingLayoutCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2ee82b1e1dcae3ea10dbd92549d65a6c>>
* @generated SignedSource<<e9cc7d01ac1884710f131fbf375f3502>>
*/

/**
Expand Down Expand Up @@ -74,6 +74,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun enableFabricLogs(): Boolean

@DoNotStrip @JvmStatic public external fun enableFlexboxAutoMinSizeInStrictMode(): Boolean

@DoNotStrip @JvmStatic public external fun enableFontScaleChangesUpdatingLayout(): Boolean

@DoNotStrip @JvmStatic public external fun enableIOSTextBaselineOffsetPerLine(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<738a114e73ddb940fb14efd0dff79d1b>>
* @generated SignedSource<<061d668cf04041f4d3d2f48f11dc739f>>
*/

/**
Expand Down Expand Up @@ -69,6 +69,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableFabricLogs(): Boolean = false

override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean = false

override fun enableFontScaleChangesUpdatingLayout(): Boolean = true

override fun enableIOSTextBaselineOffsetPerLine(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<d5b84c7e0c58f61d891e0dd63f61b4c0>>
* @generated SignedSource<<fa85d53197cbdce6b1373fbadf3cf2b9>>
*/

/**
Expand Down Expand Up @@ -47,6 +47,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableExclusivePropsUpdateAndroidCache: Boolean? = null
private var enableFabricCommitBranchingCache: Boolean? = null
private var enableFabricLogsCache: Boolean? = null
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
Expand Down Expand Up @@ -342,6 +343,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean {
var cached = enableFlexboxAutoMinSizeInStrictModeCache
if (cached == null) {
cached = currentProvider.enableFlexboxAutoMinSizeInStrictMode()
accessedFeatureFlags.add("enableFlexboxAutoMinSizeInStrictMode")
enableFlexboxAutoMinSizeInStrictModeCache = cached
}
return cached
}

override fun enableFontScaleChangesUpdatingLayout(): Boolean {
var cached = enableFontScaleChangesUpdatingLayoutCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c481d046dea2f8c8ca77b70d41f86430>>
* @generated SignedSource<<21e8d5e2a4a37e0a51f25609b80f4924>>
*/

/**
Expand All @@ -25,6 +25,8 @@ public open class ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android :

override fun cxxNativeAnimatedEnabled(): Boolean = true

override fun enableFlexboxAutoMinSizeInStrictMode(): Boolean = true

override fun enableRuntimeSchedulerQueueClearingOnError(): Boolean = true

override fun enableSchedulerDelegateInvalidation(): Boolean = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a3dbeb4eec6efecc4fc355b15a984e58>>
* @generated SignedSource<<a460b28871fc3f928dcc2d1a3bf66422>>
*/

/**
Expand Down Expand Up @@ -69,6 +69,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableFabricLogs(): Boolean

@DoNotStrip public fun enableFlexboxAutoMinSizeInStrictMode(): Boolean

@DoNotStrip public fun enableFontScaleChangesUpdatingLayout(): Boolean

@DoNotStrip public fun enableIOSTextBaselineOffsetPerLine(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,23 @@ public abstract class YogaConfig {

public abstract fun setErrata(errata: YogaErrata)

/**
* Sets the errata bitmask directly from an [Int]. Use this when combining multiple [YogaErrata]
* values (e.g., `YogaErrata.CLASSIC.intValue() and
* YogaErrata.STRETCH_FLEX_BASIS.intValue().inv()`) — the [YogaErrata] enum cannot represent
* arbitrary bitmask combinations.
*/
public abstract fun setErrata(errata: Int)

public abstract fun getErrata(): YogaErrata

/**
* Returns the errata bitmask as a raw [Int]. Use this companion to [setErrata] (Int) when the
* stored bitmask combines bits in a way the [YogaErrata] enum cannot represent — calling
* [getErrata] in that case throws [IllegalArgumentException] from `YogaErrata.fromInt`.
*/
public abstract fun getErrataInt(): Int

public abstract fun setLogger(logger: YogaLogger?)

public abstract fun getLogger(): YogaLogger?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ private constructor(@JvmField protected var nativePointer: Long) : YogaConfig()
YogaNative.jni_YGConfigSetErrataJNI(nativePointer, errata.intValue())
}

public override fun setErrata(errata: Int) {
YogaNative.jni_YGConfigSetErrataJNI(nativePointer, errata)
}

public override fun getErrata(): YogaErrata =
YogaErrata.fromInt(YogaNative.jni_YGConfigGetErrataJNI(nativePointer))

public override fun getErrataInt(): Int = YogaNative.jni_YGConfigGetErrataJNI(nativePointer)

public override fun setLogger(logger: YogaLogger?) {
_logger = logger
YogaNative.jni_YGConfigSetLoggerJNI(nativePointer, logger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum class YogaErrata(public val intValue: Int) {
STRETCH_FLEX_BASIS(1),
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
MIN_SIZE_UNDEFINED_INSTEAD_OF_AUTO(8),
ALL(2147483647),
CLASSIC(2147483646);

Expand All @@ -27,6 +28,7 @@ public enum class YogaErrata(public val intValue: Int) {
1 -> STRETCH_FLEX_BASIS
2 -> ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING
4 -> ABSOLUTE_PERCENT_AGAINST_INNER_SIZE
8 -> MIN_SIZE_UNDEFINED_INSTEAD_OF_AUTO
2147483647 -> ALL
2147483646 -> CLASSIC
else -> throw IllegalArgumentException("Unknown enum value: $value")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,22 @@ public object YogaNative {
@JvmStatic
public external fun jni_YGNodeSetHasMeasureFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)

@JvmStatic
public external fun jni_YGNodeSetHasMinContentMeasureFuncJNI(
nativePointer: Long,
hasMinContentMeasureFunc: Boolean,
)

@JvmStatic
public external fun jni_YGNodeSetMinContentWidthJNI(nativePointer: Long, minContentWidth: Float)

@JvmStatic
public external fun jni_YGNodeSetMinContentHeightJNI(nativePointer: Long, minContentHeight: Float)

@JvmStatic public external fun jni_YGNodeGetMinContentWidthJNI(nativePointer: Long): Float

@JvmStatic public external fun jni_YGNodeGetMinContentHeightJNI(nativePointer: Long): Float

@JvmStatic
public external fun jni_YGNodeSetHasBaselineFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,16 @@ public abstract class YogaNode : YogaProps {

abstract override fun setMeasureFunction(measureFunction: YogaMeasureFunction?)

abstract override fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?)

abstract override fun setMinContentWidth(minContentWidth: Float)

abstract override fun setMinContentHeight(minContentHeight: Float)

abstract override fun getMinContentWidth(): Float

abstract override fun getMinContentHeight(): Float

abstract override fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?)

public abstract val isMeasureDefined: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
private var config: YogaConfig? = null
private var children: MutableList<YogaNodeJNIBase>? = null
private var measureFunction: YogaMeasureFunction? = null
private var minContentMeasureFunction: YogaMeasureFunction? = null
private var baselineFunction: YogaBaselineFunction? = null
protected var nativePointer: Long = 0

Expand Down Expand Up @@ -46,6 +47,7 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {

override fun reset() {
measureFunction = null
minContentMeasureFunction = null
baselineFunction = null
data = null
arr = null
Expand Down Expand Up @@ -524,6 +526,25 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(nativePointer, measureFunction != null)
}

override fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?) {
this.minContentMeasureFunction = measureFunction
YogaNative.jni_YGNodeSetHasMinContentMeasureFuncJNI(nativePointer, measureFunction != null)
}

override fun setMinContentWidth(minContentWidth: Float) {
YogaNative.jni_YGNodeSetMinContentWidthJNI(nativePointer, minContentWidth)
}

override fun setMinContentHeight(minContentHeight: Float) {
YogaNative.jni_YGNodeSetMinContentHeightJNI(nativePointer, minContentHeight)
}

override fun getMinContentWidth(): Float =
YogaNative.jni_YGNodeGetMinContentWidthJNI(nativePointer)

override fun getMinContentHeight(): Float =
YogaNative.jni_YGNodeGetMinContentHeightJNI(nativePointer)

override fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) {
YogaNative.jni_YGNodeSetAlwaysFormsContainingBlockJNI(
nativePointer,
Expand All @@ -547,6 +568,27 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
)
}

// Native callback invoked by Yoga during the CSS Flexbox §4.5 auto-min
// probe when a min-content measure function is registered. Mirrors
// [measure]; see that method's note on non-overridability.
@DoNotStrip
public fun measureMinContent(
width: Float,
widthMode: Int,
height: Float,
heightMode: Int,
): Long {
val mf =
checkNotNull(minContentMeasureFunction) { "Min-content measure function isn't defined!" }
return mf.measure(
this,
width,
YogaMeasureMode.fromInt(widthMode),
height,
YogaMeasureMode.fromInt(heightMode),
)
}

override fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?) {
baselineFunction = yogaBaselineFunction
YogaNative.jni_YGNodeSetHasBaselineFuncJNI(nativePointer, yogaBaselineFunction != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,28 @@ public interface YogaProps {

public fun setMeasureFunction(measureFunction: YogaMeasureFunction?)

public fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?)

/**
* Sets the static min-content width used by the CSS Flexbox §4.5 automatic minimum sizing probe.
* Pass `YogaConstants.UNDEFINED` to clear. See `YGNodeSetMinContentWidth` in the Yoga C API for
* full precedence rules.
*/
public fun setMinContentWidth(minContentWidth: Float)

/**
* Sets the static min-content height used by the CSS Flexbox §4.5 automatic minimum sizing probe.
* Pass `YogaConstants.UNDEFINED` to clear. See `YGNodeSetMinContentHeight` in the Yoga C API for
* full precedence rules.
*/
public fun setMinContentHeight(minContentHeight: Float)

/** Returns the static min-content width, or `YogaConstants.UNDEFINED` if not set. */
public fun getMinContentWidth(): Float

/** Returns the static min-content height, or `YogaConstants.UNDEFINED` if not set. */
public fun getMinContentHeight(): Float

public fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?)

/* Mutable properties - getter and setter with matching types */
Expand Down
Loading
Loading