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.

https://github.com/gorhom/react-native-bottom-sheet/assets/71296097/e8d5b1e7-a747-4c07-b4c7-f0fc6959fbf5

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

  1. Open the app
  2. Scroll to the bottom of the Flatlist
  3. open the keyboard by selecting the textinput that is the last one you can see
  4. close it by pressing enter
  5. App crashes

Describe what you expected to happen:

  1. The Keyboard closes and restores the bottomsheet to its former state

Reproducible sample code

https://github.com/motudev/bottomsheet-example

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 5
  • Comments: 19 (2 by maintainers)

Most upvoted comments

I managed to resolve the app crashing issue when the keyboard is dismissed by setting the enableBlurKeyboardOnGesture property on BottomSheetModal to true.

<BottomSheetModal
        ref={ref}
        backdropComponent={renderBackdrop}
        handleComponent={renderSheetHandle}
        keyboardBlurBehavior="restore"
        enableBlurKeyboardOnGesture={true}>
        <BottomSheetScrollView
          contentContainerStyle={[styles.card, {paddingBottom: insets.bottom}]}>
        ...
        </BottomSheetScrollView>
</BottomSheetModal>

+1 facing same issue with BottomSheetModal > BottomSheetScrollView > BottomSheetTextInput The workaround which fixed for me was to swap BottomSheetScrollView with https://www.npmjs.com/package/react-native-keyboard-aware-scroll-view and BottomSheetTextInput with regular TextInput

hey. 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?