react-native-bottom-sheet: [v4] bottomsheettextinput autofocus bugs

Bug

When using a BottomSheetTextInput inside a bottomsheet (not a modal), it has many issue in latest version on RN0.73+

=> if using autofocus, it will “blink” open the sheet / display keyboard / and close itself right away (randomly, 8 times out of 10) => when it “works” and open, it won’t respect the sheet height (snapPoint) I wanted, 9 times out of 10 and will just open full height In the first attached video, we can see the second case, first time autofocus open the sheet at its expected height, second it opens it full screen height without caring about my snapPoint

bottomsheetinput_issue.webm

On the other hand, if I remove the autofocus: snapPoints is initially respected, but as soon as I tap the input then the keyboard expanding will blink and close the sheet right away (second video)

https://github.com/gorhom/react-native-bottom-sheet/assets/17619412/f663c73f-b9b6-40fa-9adf-aaf33bd2164f

My code is very basic:

<AppBottomSheet
        index={0}
        snapPoints={[300]}
        onClose={closeSheetName}
        >
            <BottomSheetTextInput
                value={newName}
                onChangeText={setNewName}
                isDisabled={isLoading}
                autoFocus
                ...

Environment info

Library Version
@gorhom/bottom-sheet 4.6.0
react-native 0.73.4
react-native-reanimated 3.6.2
react-native-gesture-handler 2.15.0

Steps To Reproduce

  1. use BottomSheetTextInput
  2. focus on it
  3. see the keyboard appear/sheet closing in a blink

Describe what you expected to happen:

  1. I want my snapPoint to be respected
  2. I dont want the sheet to close itself

Reproducible sample code

https://snack.expo.io/@gorhom/bottom-sheet-v4-reproducible-issue-template

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 9
  • Comments: 21

Most upvoted comments

This issue was closed because it has been stalled for 5 days with no activity.

same problem

not stale; still happening.

Still happening, please reopen the issue

I’m experience this also on BottomSheetTextInput on IOS

+1

any updates?

same

v5.0.5

If set autofocus={true} to the input, then onAnimate will work twice. Because of this, the backdrop is animated twice and creates a visual flicker (Android). On iOS the backdrop appears normally.

@gorhom please fix it

https://github.com/user-attachments/assets/56d98106-658b-4c0b-aa70-9734f1b2620a