-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Disable keyboard #14045
Comments
See docs on import {Keyboard} from 'react-native'
<TextInput
onFocus={Keyboard.dismiss()}
/> |
Unfortunately, this code also makes unfocus and Keyboard appears for 1 second, but I need TextInput to stay focused |
Could you please provide a bit more context, what is the point to have "focused" |
The point is to create custom keyboard, with custom animation, which will be used to fill input, instead of default keyboard |
+1, need custom keyboard with TextInput, just want that keyboard never show when TextInput focus |
@walkerxiong https://github.com/wix/react-native-keyboard-input custom keyboard |
@nazarTrynko thanks, i tried it some time ago and i find that the system keyboard still will show at the first time and then quickly hide, that appear flicker, so this lib also can't solve our problem. |
has anyone solved this problem, i also am facing one, if i use 'Keyboard.dismiss' i loose the focus on my text input i am using custom keyboard which itself is part of my screen so i don't want any keyboard to show up at all without loosing the focus on my text input, any solution please. |
Anyone solved this?? Huge problem for me as well |
+1 |
I'm facing same requirement, at this point I think the best course of action is to get rid of |
Anyone solved this?? Huge problem for me as well |
I'm developing react native android app on handheld mobile computer(Honeywell ScanPal), try to disable soft keyboard, modify the source code like below, then build app from react native source code. Modify
Now click the TextInput, the soft keyboard will be hide, But it still show when the TextInput be clicked twice in succession, I'm not find the solution, but it's enough for me. My english is not good, hope you got it.
Ref: https://facebook.github.io/react-native/releases/0.49/docs/android-building-from-source.html |
So, the actual solution for all mentioned cases can be providing a way to customize/replace standard keyboard (inputView)? Right? |
@shergin In some cases the solution may be to provide a setting to have the keyboard not come up at all when the field is selected. I may not want any input view (because I want my num pad to show on the view whether or not the text field is selected - disabled if not selected) but I think it would be a higher priority to provide a custom input view functionality because what i describe here is an edge case, and would probably be solved by a 0 height inputView |
a The only downside of that is that we lose the cursor. |
Yeah, a |
@react-native-bot Why was this closed at all? |
+1 |
1 similar comment
👍 |
This is a must requirement and a VERY valid use case. I am clicking on TextInput to transition to another screen. Something like this Now, I need Keyboard to NOT show up when the search bar in the first screen is in focus. But as everyone over here is saying, it shows up for a split second even if you call dismiss(). Please don't ignore genuine requests.. |
@nitinsh99 talking to a bot? 😛 |
In my case, I solved a similar issue with this "trick":
PS.: Works only on iOS I hope that this snippet help someone. |
yeah, we miss the focus when disable editing, the custom keyboard makes things more complicated. |
Please keep this one open, while it's an infrequent use case it's a very important one for those of us looking to optimize the users experience in data management. |
+1, |
Dose any one found solution to disable the keyboard in ios with textInput stay focused |
when I use editable={false} it won't trigger onTouchStart event, but trigger when editable={true} do you know why? by the way, where is onTouchStart event, I cannot find it in react-native document? |
Thank you @jacek213 !!! Exactly what I needed. I'm doing the same thing with |
@hramos Can you please re-open this issue? It looks pretty clear from the number of requests that this is still a valid concern without a proper solution for both platforms. Many large scale apps implement custom keyboards and the provided suggestions are not adequate for a good UX. |
keyboardType={'none'} would be really nice. |
@jacek213 Thanks! This gets the job done! |
@jacek213 this disables the edit: maybe a |
come on!anyone has solution? |
+1 |
Thank you @RocKhalil! You've saved my day... Best regards |
I opened #25028 which allows to overcome this limitation properly - i.e. without having to hide the native keyboard when it appears. Is any react-native contributor able to review it? |
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes #14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: #25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
wooooooooow... |
I am also working with a barcode scanner that acts like a keyboard.
Thank you @riso ! edit: It seems the modules I am using are not ready for 0.60 yet so it's a shame this commit got delayed until after 0.59 |
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes #14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: #25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
This hasn't been solved because |
I changed the method
the keyboard will not show any more. just call |
is there any solution for iOS .. it is working but still for few seconds keyboard is appearing which looks irritating |
|
Summary: Add prop showSoftInputOnFocus to TextInput. This fixes facebook#14045. This prop can be used to prevent the system keyboard from displaying at all when focusing an input text, for example if a custom keyboard component needs to be displayed instead. On Android, currently TextInput always open the soft keyboard when focused. This is because `requestFocus` calls `showSoftKeyboard`, which in turn instructs `InputMethodManager` to show the soft keyboard. Unfortunately even if we were to define a new input type that extends ReactEditText, there is no way to overcome this issue. This is because `showSoftKeyboard` is a private method so it can't be overriden. And at the same time `requestFocus` needs to invoke `super.requestFocus` to properly instruct Android that the field has gained focused, so overriding `requestFocus` in a subclass of ReactEditText is also not an option, as when invoking `super.requestFocus` we would end up calling again the one defined in ReactEditText. So currently the only way of doing this is to basically add a listener on the focus event that will close the soft keyboard immediately after. But for a split second it will still be displayed. The code in the PR changes `requestFocus` to honor showSoftInputOnFocus as defined in Android TextView, displaying the soft keyboard unless instructed otherwise. ## Changelog [Android] [Added] - Add showSoftInputOnFocus to TextInput Pull Request resolved: facebook#25028 Differential Revision: D15503070 Pulled By: mdvacca fbshipit-source-id: db4616fa165643d6ef2b3185008c4d279ae08092
Hi, I'm using View as a custom keyboard. Is it possible that default Keyboard is not showing when TextInput is in focus?
The text was updated successfully, but these errors were encountered: