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
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)
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
- use BottomSheetTextInput
- focus on it
- see the keyboard appear/sheet closing in a blink
Describe what you expected to happen:
- I want my snapPoint to be respected
- 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
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
Hmm, the autofocus works, but it immediately shows the bottom sheet.
https://github.com/gorhom/react-native-bottom-sheet/assets/10897778/4d3eba01-1ad3-4a1b-83f9-63df88169835
https://github.com/gorhom/react-native-bottom-sheet/assets/56620672/121cedd8-7c7a-495e-bbf2-9fc866988422
I am facing the textinput would move in slightly.