Skip to content

feat: animated closeAll & onBeforeClose#19

Merged
arekkubaczkowski merged 12 commits into
mainfrom
claude/analyze-module-features-MV6NR
Feb 17, 2026
Merged

feat: animated closeAll & onBeforeClose#19
arekkubaczkowski merged 12 commits into
mainfrom
claude/analyze-module-features-MV6NR

Conversation

@arekkubaczkowski
Copy link
Copy Markdown
Owner

No description provided.

claude and others added 12 commits February 16, 2026 19:27
…ceptor

closeAll() closes all sheets in a group from top to bottom with
staggered animation delays (configurable via `stagger` option),
similar to popToRoot in React Navigation.

onBeforeClose allows sheets to intercept and prevent closing by
registering a callback via useOnBeforeClose hook. The callback
can return false (sync or async) to cancel the close. All close
paths (backdrop tap, swipe dismiss, programmatic close, closeAll)
respect the interceptor. A forceClose() method is provided on
useBottomSheetContext to bypass the interceptor when needed.

https://claude.ai/code/session_014M8zrTTx3wtbNXKCHmJNaw
…is active

When useOnBeforeClose is registered, the sheet now sets preventDismiss
in the store. All adapters read this flag and disable native dismiss
gestures:
- GorhomSheetAdapter: disables enablePanDownToClose
- ReactNativeModalAdapter: disables swipeDirection and onSwipeComplete
- ActionsSheetAdapter: disables gestureEnabled, closeOnTouchBackdrop,
  closeOnPressBack

This ensures the interceptor actually prevents closing at the gesture
level, not just the programmatic level.

https://claude.ai/code/session_014M8zrTTx3wtbNXKCHmJNaw
Mirrors the existing cleanup pattern for sheetRefs and animatedIndexes.
Ensures the global onBeforeClose map doesn't leak stale callbacks when
sheets are removed via clearGroup, clearAll, or normal close flows.

https://claude.ai/code/session_014M8zrTTx3wtbNXKCHmJNaw
Replace all `void requestClose(...)` patterns with plain calls.
Simplify handleDismiss interceptor to reuse requestClose directly.
Add proper dependency array to useOnBeforeClose useEffect.

https://claude.ai/code/session_014M8zrTTx3wtbNXKCHmJNaw
- New docs/close-interception.md: useOnBeforeClose, forceClose,
  closeAll cascade behavior, async interceptors, adapter support
- hooks.md: add useOnBeforeClose section, closeAll to manager/control,
  forceClose to context returns
- types.md: add OnBeforeCloseCallback, CloseAllOptions, preventDismiss
  and keepMounted to BottomSheetState, update return type interfaces
- intro.md: add close interception and cascading close to features list
- sidebars.ts: add close-interception page

https://claude.ai/code/session_014M8zrTTx3wtbNXKCHmJNaw
@arekkubaczkowski arekkubaczkowski merged commit 15a2158 into main Feb 17, 2026
3 checks passed
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