Skip to content

fix: complete web pan-down close lifecycle - #2756

Open
huytdps13400 wants to merge 1 commit into
gorhom:masterfrom
huytdps13400:fix/2749-safari-dismiss-lifecycle
Open

fix: complete web pan-down close lifecycle#2756
huytdps13400 wants to merge 1 commit into
gorhom:masterfrom
huytdps13400:fix/2749-safari-dismiss-lifecycle

Conversation

@huytdps13400

Copy link
Copy Markdown

Motivation\n\nA fast downward pan in Safari Web can move the sheet to its closed detent before the gesture end handler runs. Both the web handler and the shared animator then treated the equal target/current position as a no-op, so the modal became visually hidden without emitting onChange(-1), onClose, or onDismiss.\n\n## Changes\n\n- forward an already-reached closed detent from the web gesture end handler\n- settle a gesture-driven close when the pixel position is already reached but the current index is not -1\n- reuse the existing animation completion path so onAnimate, onChange, and onClose retain their normal order\n- preserve no-op behavior for duplicate closes and ordinary same-position operations\n\nFixes #2749\n\n## Verification\n\n- yarn typescript\n- focused Biome lint on both changed files\n- yarn build\n- git diff --check\n- deterministic state-transition probe: original path drops all close callbacks; fixed path emits one onAnimate/onChange/onClose, suppresses duplicate close, and cancels a conflicting animation\n\nThe repository-wide yarn lint currently fails on an existing warning in src/hooks/useBoundingClientRect.ts; neither this PR nor the focused lint touches that file.\n\nA Safari/WebKit runtime pass was not available locally because the checked-in example/package-lock.json is stale relative to example/package.json, so npm ci cannot construct the owner example without rewriting its lockfile. The issue Snack remains the browser reproduction.

Settle the close index when a web gesture reaches the closed detent before its end event.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant