Fix sheets ignoring their detents#58
Merged
Merged
Conversation
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.
A full-size
.sheetcame up as a short strip at the bottom of the screen instead of covering it.Cause
The Swift side has emitted a
detentsprop since sheets landed, but the interpreter never read it. Every sheet was therefore the same defaultModalBottomSheet, and a Material sheet is only as tall as its content — so the sheet wrapped its two small views and stopped there. The same omission made.presentationDetents([.medium])a no-op: both sheets in the gallery rendered identically.Fix
Read the detents and size the sheet accordingly:
.large→ fills the height, and skips the partially-expanded stop since there's no partial detent to rest at.mediumonly → rests at half heightThe height has to be applied to the sheet's content (
fillMaxHeight), not just the sheet state:skipPartiallyExpandedonly chooses which anchor the sheet settles on, it doesn't make short content occupy the screen. That distinction is what the original code was missing.Verification
swift test— added the missing emission test (a declared.mediumreaches the node; no detents emits an empty array, which the interpreter reads as full height), 97 total passing