Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v4] bottomsheettextinput autofocus bugs #1747

Open
pierroo opened this issue Feb 20, 2024 · 9 comments
Open

[v4] bottomsheettextinput autofocus bugs #1747

pierroo opened this issue Feb 20, 2024 · 9 comments
Labels
bug Something isn't working no-issue-activity

Comments

@pierroo
Copy link

pierroo commented Feb 20, 2024

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)

bfdee7c0-73bd-4c14-9c8a-87c014295e2c.mp4

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

@pierroo pierroo added the bug Something isn't working label Feb 20, 2024
@Kavosh-m
Copy link

same problem with BottomSheetModal

@Leykwan132
Copy link

Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-02-24.at.19.22.26.mp4

I am facing the textinput would move in slightly.

@schactue
Copy link

schactue commented Mar 1, 2024

Same problem

@AounNaqvi173
Copy link

same

1 similar comment
@litinskii
Copy link

same

@aexomir
Copy link

aexomir commented Apr 15, 2024

any updates?

@RedkoVO
Copy link

RedkoVO commented Apr 24, 2024

Hmm, the autofocus works, but it immediately shows the bottom sheet.

2024-04-24.20.39.33.mov

@Helyios
Copy link

Helyios commented Apr 26, 2024

I have the same problem, as soon as I try to focus it, whether it's through a ref.current.focus() in the useEffect or with the autofocus prop, it automatically closes the bottom sheet.

The only way I found to allow it to work is to set a delay on the focus.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

9 participants