Skip to content

Add sheet presentation detent & item parameter#37

Merged
marcprux merged 4 commits intoskiptools:mainfrom
Louis-PAGNIER:main
May 31, 2024
Merged

Add sheet presentation detent & item parameter#37
marcprux merged 4 commits intoskiptools:mainfrom
Louis-PAGNIER:main

Conversation

@Louis-PAGNIER
Copy link
Copy Markdown
Contributor

I added small support for .presentationDetents([]) with sheets.
Currently only support zero or one detent in the detents list.
This commit also add support for item binding in sheet and fullScreenCover.

It is one of my first pull requests, I'm new to SwiftUI and I don't know anything about Kotlin and Compose, so tell me if anything I made is bad or wrongly implemented.

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented May 31, 2024

Thank you for your pull request and welcome to the Skip community. We require contributors to sign our contributor license agreement (CLA), and we don't seem to have the user(s) @Louis-PAGNIER on file. In order for us to review and merge your code, for each noted user please add your GitHub username to Skip's .clabot file

@Louis-PAGNIER
Copy link
Copy Markdown
Contributor Author

Also, do you know how to implement the "tap outside the sheet to dismiss" behaviour like in SwiftUI ?

@marcprux
Copy link
Copy Markdown
Member

This looks great! I'll experiment with it later today in the Showcase app's SheetPlayground and see if I can figure out the tap to dismiss, and likely merge it a bit later.

Thanks for the contribution!

@cla-bot cla-bot bot added the cla-signed label May 31, 2024
@marcprux marcprux merged commit 21eb48c into skiptools:main May 31, 2024
@marcprux
Copy link
Copy Markdown
Member

This looks good in my testing.

Screenshot 2024-05-31 at 17 56 13

I looked into how to dismiss the ModalBottomSheet when tapping outside the sheet, and it sounds like the correct way to do this is to wrap the whole view in a ModalBottomSheetLayout.

Unfortunately, this would probably require some significant refactoring. @aabewhite might be able to provide more insight, but for the time being, you'll be limited to dismissing the sheet either by swiping it down, or adding some "Dismiss" button in the sheet itself.

@Louis-PAGNIER
Copy link
Copy Markdown
Contributor Author

No problem, it's not currently very important.
Thank you for the merge & feedback :)

@marcprux
Copy link
Copy Markdown
Member

Thank again for the PR. Please keep them coming!

I've released skip-ui 0.9.6 with the new .presentationDetents support and added a demo to the Showcase app's SheetPlayground.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants