Repository navigation
Let an h-full drawer child fill the drawer's height - #212
Conversation
Both drawer hosts put their children in a scroll view, which measures them with an unbounded height, so an h-full root column hugged its content and justify-between couldn't pin a footer to the bottom. As in the scroll-view renderers, a direct child with h-full now gets the drawer's height as a minimum; taller content still grows and scrolls, and other children are unchanged. Closes NativePHP#113. Co-authored-by: Wojt Janowski <wojt@clinically.com.au>
|
Checked on an Android emulator (Pixel 9 Pro, Android 17) in a NativePHP app on nativephp/mobile 4.7.0, using a modal drawer. The drawer's root column is On main, the short drawer's root hugs its content and the footer sits right under item 4. With this change the root fills the drawer and the footer is pinned to the bottom, where the tall drawer's footer ends up when scrolled to the end. The tall drawer still scrolls as before. Light Dark iOS was checked separately, in a package that hosts the real drawer host on the iOS 27 simulator: an |
|
good stuff |


Closes #113.
Problem
Both drawer hosts put the drawer's children in a scroll view. A scroll view measures its children with an unbounded height, so an
h-fullroot column hugs its content andjustify-betweenhas no space to pin a footer ("Sign out", "Settings") to the bottom of the drawer.Fix
The same rule the scroll-view renderers already use: a direct child with
h-fullgets the drawer's height as a minimum. Content taller than the drawer still grows and scrolls, and children withouth-fullare unchanged.NativeLayoutDrawerHost.kt):BoxWithConstraintssupplies the drawer height, and only fill-height children getModifier.heightIn(min = viewport), with their width reproduced, as inScrollViewRenderer. The patch in the issue gave every child the minimum, which makes a drawer with two children two drawers tall.NativeUIDrawerHost.swift): aGeometryReaderaround theScrollViewsupplies the panel height, less the top inset the content is padded by, to fill-height children throughMinViewportHeightModifier, which is now shared with the scroll-view renderer instead of private.Test plan
DrawerFillHeightTestopens a modal drawer from its menu button. Theh-fullroot reaches the bottom of the drawer (on main it's 120dp in a 470dp drawer), a sibling withouth-fullkeeps its own height, and a root taller than the drawer still scrolls. Wholetests/androidsuite passes. Changing the minimum to a fixed height, or giving every child the minimum, each fails a case.NativeUIDrawerHost.swiftin a throwaway Swift package with a stand-inNodeViewand laid it out in a 400×800 window on an iPhone 17 Pro / iOS 27.0 simulator. Anh-fullchild measured 20pt on main and 800pt with the fix; a sibling stayed at 20pt.justify-betweenitself is only exercised through the real renderers, not the stand-ins.material-icons-core, because the drawer host drawsIcons.Filled.Menu.