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

Focus problem #338

Open
brkcnaka opened this issue Jan 7, 2025 · 5 comments
Open

Focus problem #338

brkcnaka opened this issue Jan 7, 2025 · 5 comments

Comments

@brkcnaka
Copy link

brkcnaka commented Jan 7, 2025

The version I was currently using in my project was v5.4.0. With the last update, I switched to v5.5.5. However, in this version, I could not focus on the input I rendered with renderTextInput. I've only tried it on iOS, I don't know what the situation is on Android.

I fixed the problem by downgrading back to v5.4.0.

"react-native": "0.73.6"
"expo": "50.0.20"

@thomasviaud
Copy link

Same problem here

@thomasviaud
Copy link

I've managed to fix this by wrapping the render function in a useCallback hook:

  const renderTextInput = React.useCallback((props: TextInputProps) => <YourCustomInput {...props} />, [])

and then:

<Autocomplete
        ...
        renderTextInput={renderTextInput}
        ...
/>

@titanve
Copy link

titanve commented Jan 12, 2025

@thomasviaud suggestion fixed the issue for me, thanks!

@shrouxm
Copy link

shrouxm commented Jan 15, 2025

we are also experiencing this, any time the renderTextInput prop changes focus is lost, which can be awkward to work around if there's a reason the text input style may change while the user is editing the text (e.g. form validation).

@mrlaessig
Copy link
Collaborator

This should be fixed with in v5.5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants