react-native-bottom-sheet: BottomSheetModal crashes app when closed with Back Button

Bug

Hello, I came across a Bug while working with the Backbutton and BottomSheetModal. When the BottomSheetModal ist open and extended, and the user navigates back to the previous screen with the Back Button, while the Modal is extended, the BottomSheetModal can not be opened again after navigation back to the second screen. In porduction mode, I get the error Cannot read property 'minimize' of null, and Maximum call stack size exceeded (native stack depth).h. Also, look here: https://github.com/gorhom/react-native-portal/issues/15#issuecomment-850577091

Environment info

Library Version
@gorhom/bottom-sheet ^3.6.5 && 4.0.0-alpha.11
react-native 0.63
react-native-reanimated ^2.1.0
react-native-gesture-handler ~1.10.2

Steps To Reproduce

Describe what you expected to happen:

  1. The Modal should be able to open itself again.
  2. No crashes

Reproducible sample code

I was able to reproduce the bug in Expo Snack. Here is the Link: Expo Snack Reproductible Sample Code

https://user-images.githubusercontent.com/61253912/120039688-9f9a6f80-c005-11eb-8ccd-82ed21c88ee5.mp4

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

I have this issue on v2.4.1. Is there any solution to fix the issue in this version? @gorhom @alexco2

I was able to reproduce the error in dev mode with the latest version alpa 11. Most of the time, after using the back button when the Bottom Sheet modal is open, the Sheet can not be opened again. Sometimes I also get this error.

alpha 11 error

@gorhom I upgraded to v4 and it looks like the bug does not appear anymore. I will test further and if I do not encounter this bug anymore I will close this issue.

@gorhom I tried to reproduce the error in the snack you provided https://snack.expo.io/@gorhom/portal-example, but was not able to. Do you think the bug is in the react-native-portal library?

@kingdark1234 could you try to reproduce the error in the snack I provided? (https://snack.expo.io/@expoco2/bottomsheet-bug-repro)

@alexco2 thanks for helping so far, i would appreciate if you could test @gorhom/portal v1.0.7 👏