fix(ios): use parent padding in flexbox child measure specs - #11469
Open
aleclarson wants to merge 1 commit into
Open
aleclarson wants to merge 1 commit into
aleclarson wants to merge 1 commit into
Conversation
|
View your CI Pipeline Execution ↗ for commit 7bfbe9f
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
commit: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What is the current behavior?
On iOS,
FlexboxLayout.getChildMeasureSpecis called with the child's own padding where the AOSPFlexboxLayoutimplementation it's ported from passes the parent's padding plus the child's margins:The mismatch is visible whenever a flex child is re-measured against a fixed parent constraint. Concretely: a
ROWchild inside aCOLUMNflexbox that gets stretched (_stretchViewVerticallyre-measure) is re-measured withEXACTLY <rowHeight>on the cross axis, and the child-spec computation subtracts the child's own padding — so a control with 10dip vertical padding inside a 37dip row is clamped to 17dip content height and its label collapses.This shows up as buttons/labels squished to a minimum height inside
items-centerflex rows — plausibly the root cause behind #5194 (padding ignored inside flexbox-layout) and possibly #4834.What is the new behavior?
All
getChildMeasureSpeccall sites inindex.ios.tsnow consistently subtract the parent's padding and the child's margins, matching the AOSP reference and the two call sites that were already correct (lines 388–389).Verified on a real app: padded buttons inside stretched rows measure 37dip (correct) instead of 17dip (collapsed).
Android is unaffected — it delegates to
org.nativescript.widgets.FlexboxLayout(the real Google Flexbox library).Testing note
The affected code runs inside the iOS measure pass;
packages/corehas no flexbox spec today and Vitest mocks the platform globals, so a unit test would need to mock the whole native measure pipeline. I verified the fix by patching the installed package in an app: controls that previously measured85x17now measure85x37with visible labels. Anapps/automatedcase asserting child height inside anitems-centerrow would cover this going forward — happy to add one if you'd like.