Skip to content

fix: bottom sheet modals fail to reopen after being dismissed - #6039

Merged
janicduplessis merged 2 commits into
developfrom
janic/fix-bottom-sheet-reopen
Jul 2, 2026
Merged

fix: bottom sheet modals fail to reopen after being dismissed#6039
janicduplessis merged 2 commits into
developfrom
janic/fix-bottom-sheet-reopen

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Since the Expo 56 upgrade bumped @gorhom/bottom-sheet from 5.2.6 to 5.2.14, modal bottom sheets — everything rendered through ActionSheet / BottomSheetWrapper with modal, e.g. the personal invite sheet on the Home header — can only be opened once per mount. Closing the sheet and tapping the trigger again silently does nothing until the screen remounts.

Changes

Two independent problems, both in the modal path of BottomSheetWrapper:

  • Extend the existing @gorhom/bottom-sheet pnpm patch with the fix proposed in gorhom/react-native-bottom-sheet#2669 (no fixed release exists yet; 5.2.14 is latest — fix submitted upstream as gorhom/react-native-bottom-sheet#2711). 5.2.7's new MODAL_STATUS state machine gets permanently stuck in DISMISSING when dismiss() is called on an already-dismissed modal, so every later present() silently bails. Our wrapper always calls dismiss() after a user-initiated close (backdrop tap / swipe down), so the first close corrupted the modal. The patch treats INITIAL as already-closed in handleDismiss, making it idempotent.

  • Sync parent state from the modal's onDismiss. Gorhom never emits onChange(-1) when a sheet is dismissed before its open animation finishes, so open stayed stuck at true and later opens became state no-ops (setOpen(true) with state already true → effect never re-runs → no present()). onDismiss fires on every dismissal path; the handler only calls onOpenChange(false) when the parent still believes the sheet is open, so programmatic closes behave as before. Worst case is an extra onOpenChange(false) after a close, which consumers already receive from onChange(-1) today.

How did I test?

iOS simulator, dev build, on the personal invite sheet (Home header → AddPerson):

  • Before: open → close via backdrop → tap again → nothing happens (video below).
  • After: three consecutive open/close cycles all work, and the tight case (dismissing while the open animation is still running) also reopens correctly.

Risks and impact

  • Safe to rollback without consulting PR author? (Yes)
  • Affects important code area:
    • Onboarding
    • State / providers
    • Message sync
    • Channel display
    • Notifications
    • Other: all modal bottom sheets on native

The lib patch only widens handleDismiss's already-closed early-exit; non-modal sheets are untouched.

Rollback plan

Revert the commit — it restores the previous patch file, lockfile patch hash, and wrapper behavior.

Screenshots / videos

Before (sheet opens once, second tap dead):

repro-before-trimmed.mp4

After (repeated open/close cycles):

fixed-demo.mp4

Since the bottom-sheet 5.2.6 to 5.2.14 bump in the Expo 56 upgrade, modal
sheets (e.g. the personal invite sheet) could only be opened once. Two
separate issues:

- gorhom 5.2.7+ replaced the modal's boolean refs with a MODAL_STATUS
  state machine in which dismiss() on an already-dismissed modal (status
  INITIAL) falls through, permanently corrupts the status to DISMISSING,
  and makes every later present() a silent no-op. BottomSheetWrapper
  calls dismiss() whenever open flips false, which always happens after
  a user-initiated close has already dismissed the modal internally.
  Extend our existing pnpm patch with the upstream-proposed fix
  (gorhom/react-native-bottom-sheet#2669): treat INITIAL as already
  closed in handleDismiss.

- gorhom never emits onChange(-1) when a sheet is dismissed before its
  open animation completes, so handleSheetChanges couldn't sync parent
  state and open stayed stuck at true, turning later opens into no-ops.
  Wire the modal's onDismiss callback to sync parent state whenever it
  still believes the sheet is open.
@janicduplessis
janicduplessis marked this pull request as ready for review July 1, 2026 23:08
@janicduplessis
janicduplessis merged commit 94bfbf6 into develop Jul 2, 2026
5 checks passed
@janicduplessis
janicduplessis deleted the janic/fix-bottom-sheet-reopen branch July 2, 2026 03:39
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.

2 participants