react-native-bottom-sheet: [v4] IOS: Closing Keyboard crashes if BottomSheetTextInput is inside of BottomSheetFlatlist or BottomSheetScrollView
Bug
On IOS, when closing the keyboard of a BottomSheetTextInput at the bottom of a BottomSheetFlatlist the app crashes and closes. Rarely the keyboard just closes and acts as it is supposed to.
I already did some digging and if I comment out the line in
src/components/bottomSheet/BottomSheet.tsx line 1461 (not 1462)
weirdly the flatlist is not animated anymore but also does not crash anymore. I think there is something triggered in the background which I am not aware of, which is why I am submitting this.
Environment info
| Library | Version |
|---|---|
| @gorhom/bottom-sheet | 4.5.0 |
| react-native | 0.72.4 |
| react-native-reanimated | 3.5.0 |
| react-native-gesture-handler | 2.12.1 |
Steps To Reproduce
- Open the app
- Scroll to the bottom of the Flatlist
- open the keyboard by selecting the textinput that is the last one you can see
- close it by pressing enter
- App crashes
Describe what you expected to happen:
- The Keyboard closes and restores the bottomsheet to its former state
Reproducible sample code
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 5
- Comments: 19 (2 by maintainers)
I managed to resolve the app crashing issue when the keyboard is dismissed by setting the
enableBlurKeyboardOnGestureproperty onBottomSheetModaltotrue.+1 facing same issue with BottomSheetModal > BottomSheetScrollView > BottomSheetTextInput The workaround which fixed for me was to swap
BottomSheetScrollViewwith https://www.npmjs.com/package/react-native-keyboard-aware-scroll-view andBottomSheetTextInputwith regularTextInputhey. also facing this issue with android. crash when close BottomSheetTextInput. there is any solution? @gorhom
fix: #2165
Facing the same issue, @gorhom could you please take a look at this?