You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
null is not an object (evaluating 'sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref.current.restore') when calling bottomSheetModalRef.dismiss().
It happens when the modal is somehow unmounted before the animation ends (in my case because the page is unmounted from the stack of react-navigation), so
Environment info
Library
Version
@gorhom/bottom-sheet
2.0.5
react-native
0.63.4
react-native-reanimated
1.13.2
react-native-gesture-handler
1.9.0
Steps To Reproduce
To reproduce the bug you need to unmount the page containing the modal before the animation ends, so that ModalProvider will use a null ref.
I tried to add a setTimeout of 1 second (so the animation ends) before unmounting the page (before calling navigation.goBack()) and everything works fine, so I think that the modal gets removed from sheetsQueue only when animation ends.
I tested with ref.dismiss() and dismiss and dismissAll from useSheetModal() and it always crashes in the same way:
open the modal
dismiss the modal and unmount the page containing it (navigation.goBack) before animation ends
open another modal
when trying to dismiss it (even with drag down) I get the error because bottomSheetModalProvider tries to restore the modal which was unmounted in step 2
Reproducible sample code
I can't provide it right now but I will add it later if you really need it
The text was updated successfully, but these errors were encountered:
Bug
null is not an object (evaluating 'sheetsQueueRef.current[sheetsQueueRef.current.length - 1].ref.current.restore')
when callingbottomSheetModalRef.dismiss()
.It happens when the modal is somehow unmounted before the animation ends (in my case because the page is unmounted from the stack of react-navigation), so
Environment info
Steps To Reproduce
To reproduce the bug you need to unmount the page containing the modal before the animation ends, so that ModalProvider will use a null ref.
I tried to add a setTimeout of 1 second (so the animation ends) before unmounting the page (before calling
navigation.goBack()
) and everything works fine, so I think that the modal gets removed from sheetsQueue only when animation ends.I tested with ref.dismiss() and dismiss and dismissAll from
useSheetModal()
and it always crashes in the same way:Reproducible sample code
I can't provide it right now but I will add it later if you really need it
The text was updated successfully, but these errors were encountered: