1.0.80
All checks were successful
Build and Release / build-and-release (push) Successful in 13m27s

This commit is contained in:
Bryan1029384756
2026-04-15 20:06:44 -05:00
parent f2dc627b76
commit 26dd013b05
16 changed files with 398 additions and 18 deletions

View File

@@ -95,6 +95,22 @@ export function BottomSheet({
return () => document.removeEventListener('keydown', handleEscape);
}, [isOpen, handleEscape]);
// Register with the global Android back-button stack so the
// hardware back key closes the topmost open sheet. Non-dismissible
// sheets opt out. Shared LIFO stack is keyed on `window`.
useEffect(() => {
if (!isOpen || !dismissible) return;
if (typeof window === 'undefined') return;
const g = window as any;
if (!g.__brycordBackStack) g.__brycordBackStack = [];
const stack: Array<() => void> = g.__brycordBackStack;
stack.push(onClose);
return () => {
const i = stack.lastIndexOf(onClose);
if (i !== -1) stack.splice(i, 1);
};
}, [isOpen, dismissible, onClose]);
// Lock body scroll while the sheet is open — keeps the underlying page
// from scrolling behind the drawer on mobile.
useEffect(() => {

View File

@@ -62,6 +62,23 @@ function ModalRoot({ isOpen, onClose, size = 'small', children, className, zInde
return () => document.removeEventListener('keydown', handleEscape);
}, [isOpen, handleEscape]);
// Register with the global back-handler stack so Android hardware
// back closes the topmost open modal (shared across packages via
// `window.__brycordBackStack`). No-op on environments without a
// window (SSR / tests).
useEffect(() => {
if (!isOpen) return;
if (typeof window === 'undefined') return;
const g = window as any;
if (!g.__brycordBackStack) g.__brycordBackStack = [];
const stack: Array<() => void> = g.__brycordBackStack;
stack.push(onClose);
return () => {
const i = stack.lastIndexOf(onClose);
if (i !== -1) stack.splice(i, 1);
};
}, [isOpen, onClose]);
return createPortal(
<AnimatePresence>
{isOpen && (