Skip to content

Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (re-land) (#57015)#57036

Closed
adityasharat wants to merge 2 commits into
facebook:mainfrom
adityasharat:export-D107181739
Closed

Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig (re-land) (#57015)#57036
adityasharat wants to merge 2 commits into
facebook:mainfrom
adityasharat:export-D107181739

Conversation

@adityasharat
Copy link
Copy Markdown

Summary:
Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in ReactProgressBarViewManager.kt and ReactSwitchManager.kt (instagram-internal) — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

Original summary:
X-link: facebook/yoga#1966

Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a YGConfig, every flex item whose main-axis min-{width,height} is undefined receives a content-derived floor — min(min-content, specified-size, max-size) plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new YGErrataMinSizeUndefinedInsteadOfAuto errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to YGErrataClassic so consumers using that constant continue to get the same default.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new YGErrataMinSizeUndefinedInsteadOfAuto errata bit on YGConfig.

Differential Revision: D107181739

…facebook#57035)

Summary:

Match `ViewManager.measure()`'s Java signature (which has always accepted nullable `localData`/`props`/`state`) and the sibling `ReactSwitchManager.kt` pattern. The Kotlin migration in D49551193 (2024-07) wrongly tightened the override on `ReactProgressBarViewManager` to non-null `ReadableMap`, which threw NPE on entry whenever the C++ side passed `nullptr` for `localData` or `state` — which `AndroidProgressBarMeasurementsManager::measure` has always done.

The latent bug was masked by Yoga's measure cache plus the now-removed `AndroidProgressBarMeasurementsManager` measurement cache (removed in D60192289, 2025-06). D105720159's CSS Flexbox §4.5 auto-min-size probe reliably bypasses Yoga's cache by calling `node->measure(... AtMost 0 ...)` per flex item, exposing the NPE and crashing Airwave on Android (T273821098, P2359486686).

Fix: change `localData`/`props`/`state` to nullable `ReadableMap?` and use safe call on `props?.getString(...)`. This unblocks D105720159 from being re-landed.

Differential Revision: D107178838
…nd) (facebook#57015)

Summary:
Re-land of D105720159, originally reverted (revert: 0e642b96c7e2) due to a latent NPE in `ReactProgressBarViewManager.kt` and `ReactSwitchManager.kt` (instagram-internal) — both fixed in the prior diffs in this stack. Crash and broken e2e tests reported in T273821098 / P2359486686.

Original summary:
X-link: facebook/yoga#1966


Implements CSS Flexbox §4.5 automatic minimum sizing in Yoga. When opted in on a `YGConfig`, every flex item whose main-axis `min-{width,height}` is undefined receives a content-derived floor — `min(min-content, specified-size, max-size)` plus any aspect-ratio-transferred lower bound — so it cannot shrink below the size CSS browsers would honor.

How to opt in: clear the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on the config. Default configs carry the bit (preserves today's behaviour); existing trees see no change. The bit is added to `YGErrataClassic` so consumers using that constant continue to get the same default.

See D105720159 for full details on precedence rules, container recursion semantics, and per-item opt-outs.

Changelog:
[General][Added] - Add CSS Flexbox §4.5 automatic minimum sizing. Opt in by clearing the new `YGErrataMinSizeUndefinedInsteadOfAuto` errata bit on `YGConfig`.

Differential Revision: D107181739
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 1, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Jun 1, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Jun 1, 2026

@adityasharat has exported this pull request. If you are a Meta employee, you can view the originating Diff in D107181739.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant