-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
focusDidSet is not called when TextInput has showSoftInputOnFocus={false} #758
Comments
I've been waiting for this issue 😅 Just to confirm - it's iOS only, right? |
Yes, basically I treated
Do you call that API yourself? Or you use |
I am pretty sure this is an edge case most won't come across and I am probably using this library in a way it wasn't designed for. I made a few of my "own" keyboards for some inputs. I wanted to add a button to let the user continue to the next text-input. I was already using rn-keyboard-controller for the keyboard avoiding and for KeyboardToolbar, so checked what functions is the toolbar internally using for navigation. I don't think there is any other way of moving to the next text-input other than some hacky way of collecting refs in a global store and manually focusing the next. I don't have a working Android version yet, but I could probably put together a simple reproduction example and test it. An example of how I am using it now. |
Nice, UI is slick 🔥 I'll try to fix this problem! I believe I could reproduce it in my example project as well 👍 |
Thank you so much for your hard work on this amazing library! |
@KingDoxik can you check if #760 fixes the problem? |
Yes, It works! 🔥 Thank you so much. Zaznam.obrazovky.2025-01-21.v.11.10.39.mov |
Awesome @KingDoxik 🔥 Will merge it today and will publish in |
Describe the bug
focusDidSet is not called when TextInput has showSoftInputOnFocus={false}. There is probably a deeper problem with showSoftInputOnFocus. I started investigating this, because I want to show custom keyboard in an app for some TextInputs and I want to add KeyboardController.setFocusTo("next") - which is not working with showSoftInputOnFocus={false}. This problem stems from onFocusDidSet being called from keyboardWillShow. I am not sure if there is a better solution, but this is what I was able to figure out without knowing iOS dev.
Code snippet
<TextInput
onFocus={handleFocus}
onBlur={handleBlur}
className="p-3 bg-zinc-800 text-white rounded-xl"
showSoftInputOnFocus={false}
{...props}
/>
Repo for reproducing
It should be reproducible in any repo by adding showSoftInputOnFocus={false} to react-native TextInput
To Reproduce
add showSoftInputOnFocus={false} to TextInput
Expected behavior
Focus change should be registered even if keyboard is not showed.
Screenshots
If applicable, add screenshots to help explain your problem.
Smartphone:
The text was updated successfully, but these errors were encountered: