Skip to content

Commit 5029c37

Browse files
authored
fix: don't delete anything from the array if there is no active sheet (#2498)(by @bradstiff)
1 parent 3db576b commit 5029c37

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/components/bottomSheetModalProvider/BottomSheetModalProvider.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@ const BottomSheetModalProviderWrapper = ({
102102
* Here we remove the unmounted sheet and update
103103
* the sheets queue.
104104
*/
105-
_sheetsQueue.splice(sheetIndex, 1);
106-
sheetsQueueRef.current = _sheetsQueue;
105+
if (sheetIndex !== -1) {
106+
_sheetsQueue.splice(sheetIndex, 1);
107+
sheetsQueueRef.current = _sheetsQueue;
108+
}
107109

108110
/**
109111
* Here we try to restore previous sheet position if unmounted

0 commit comments

Comments
 (0)