Partial sheet expansion support#2149
Conversation
|
@microsoft-github-policy-service agree company="Microsoft" |
Sources/FluentUI_iOS/Components/Bottom Sheet/BottomSheetController.swift
Outdated
Show resolved
Hide resolved
|
Don't we care to add some default value for the partial height if the client doesn't provide it in the partialHeightResolver? In which case, we'd probably need a bool opt in to supportsPartialHeight |
The way it's designed now, it's a fully opt-in feature, so we shouldn't have cases where we're trying to resolve a height and the resolver isn't there. And if it's there but doesn't return a valid value - that's a client side bug. We could have a separate bool and a default, but I'm leaning towards not adding that unless this becomes a heavily used feature. My expectation is that this will be used rarely, and often it's straight up not good UX to have that many detents. |
Platforms Impacted
Description of changes
Adds support for a new partial expansion state to bottom sheet. Most of the diff is fairly simple, the main behavioral change is that on pan end, we don't just determine the target state based on direction + velocity, but also position to see if we go towards
.partial,.expanded, or.collapsed.The other bigger change is the addition of the
partialHeightResolver, which is needed to pull fresh height from the client. It follows design of the existingcollapsedHeightResolver. I chose to cache them together, because we usually pull them together as well.Some semantic choices had to be made, like
isExpandedstill maps to.expanded, which also means tapping the resizing handle while in.partialstate takes the sheet to.expanded. That choice is fairly arbitrary, given that.partialis in-between by definition.To enable the partial state, we don't have a distinct bool - it's just inferred from the existence of the
partialHeightResolver.Verification
Various manual testing in the demo app + sanity check with client team to early integrate and test E2E. Restricted height scenarios, landscape / portrait changes - verifying sheet frame recalculates to correct new calue.
Visual Verification
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-05-07.at.17.55.31.mp4
Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow