Repository navigation
fix(ios): keep non-draggable sheets from being swiped away - #927
Conversation
With draggable set to false, pulling down on the sheet's scroll view still dismissed it when dismissible was true. Refuse a dismissal while a pan is under way on a non-draggable sheet, so only a tap outside it dismisses it, and don't report that refusal as onDismissAttempt.
|
@maxlapides is attempting to deploy a commit to the lodev09 Team on Vercel. A member of the Team first needs to authorize it. |
UIKit skips didAttemptToDismiss for a short pull, so the flag stayed set and swallowed the next onDismissAttempt (e.g. after dismissible turned false).
|
Thanks @maxlapides! Verified on iOS 27: the pull is refused, the dim tap still dismisses, and the refused pull doesn't fire Pushed one fix (0e9d5ce): Repro: The flag is now set on every |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary
With
draggable={false}, the user can't drag or resize a sheet, but on iOS pulling down on its scrollable still dismisses it whendismissibleistrue. UIKit askspresentationControllerShouldDismiss:both for that scroll-edge pull and for a tap on the dim, and TrueSheet answered withdismissiblealone.A non-draggable sheet now refuses a dismissal while a pan is under way, so it can't be swiped or pulled away. Tapping outside it still dismisses it, and
dismiss()is unaffected. The refused pull isn't reported asonDismissAttempt, since the sheet is dismissible.Draggable sheets and
dismissible={false}sheets behave as before.presentationControllerShouldDismiss:is the same onv3, and the fix applies there too, minus theonDismissAttemptpart (v3 doesn't have that event). Happy to open the v3 backport.Type of Change
Test Plan
Bare example, iPhone 17 Pro simulator (iOS 26.5). Locally, the map screen's ScrollView sheet got
draggable={false}and lost its refresh control, so a pull at the top reaches the sheet.main:onDismissAttemptdoesn't fire for the refused pull. Withdismissible={false}added, the same pull fires it as before.v3(3.11.18), same change without theonDismissAttemptpart:Checklist