gorhom / react-native-bottom-sheet

A performant interactive bottom sheet with fully configurable options 🚀
https://gorhom.dev/react-native-bottom-sheet/
MIT License
6.94k stars 756 forks source link

Bottom sheet opens when outside TextInput has autoFocus={true} #936

Closed elad30300 closed 2 years ago

elad30300 commented 2 years ago

Bug

Hi, I have a strange problem - when I have a screen which has TextInputand an Overlay which contains also TextInputthat has autoFocus={true}, the Overlayis never unmounted but is hidden using animation (set height to 0 when hidden). My whole App is wrapped by a provider that contains the BottomSheet instance in order to have a global BottomSheet for the entire app, while the content changes according to the need. For some reason the following bug occurs in the following flow:

  1. I move to the screen
  2. I enter the first input and then blur the input
  3. I open the overlay - the keyboard opens, then immediately closes and the BottomSheet is open instead - even though I don't open the BottomSheetat all.

It looks like it has something to do with the first blur of the keyboard, how can I solve it?

Thanks in advance.

Environment info

Library Version
@gorhom/bottom-sheet 4.1.5
react-native 0.63.3
react-native-reanimated 2.0.1
react-native-gesture-handler 1.8.0

Steps To Reproduce

  1. move to the screen
  2. enter the first input and then blur the input
  3. open the overlay - the keyboard opens, then immediately closes and the BottomSheet is open instead - even though I don't open the BottomSheetat all.

Describe what you expected to happen:

  1. the keyboard opens and stays in place
  2. the bottom sheet not open

Reproducible sample code

github-actions[bot] commented 2 years ago

@elad30300: hello! :wave:

This issue is being automatically closed because it does not follow the issue template.