Unable to cleanly disable keyboard in iOS in TextInput (Continuing from #14045)
See original GitHub issueI read the full discussion in #14045 and it seems to have been auto-closed without sufficient resolution. It would be great if we could have sufficient resolution of this issue without it being prematurely closed.
The issue here is that there is no way to disable the keyboard from popping up on a text input field while still allowing the user to paste into the field, which works for both iOS and Android.
- If you set
editable={false}
then you can’t paste into it so that doesn’t work as a solution. - Using
onFocus={() => Keyboard.dismiss()}
is not acceptable because the keyboard pops up for a second (both iOS and Android) so this can’t be used. - Using the new prop
showSoftInputOnFocus
does exactly what is wanted but it only works for Android. (Side note: it seems this prop isn’t included in the latest typings in 0.61.4, so there is a typescript error even though the prop works)
How can we make this work sufficiently for both iOS and Android?
React Native version: System: OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver) CPU: (8) x64 Intel® Core™ i7-9700K CPU @ 3.60GHz Memory: 3.75 GB / 61.90 GB Shell: 5.4.2 - /bin/zsh Binaries: Node: 12.13.0 - /usr/bin/node Yarn: 1.19.1 - /usr/bin/yarn npm: 6.12.0 - /usr/bin/npm SDKs: Android SDK: API Levels: 23, 26, 28, 29 Build Tools: 23.0.1, 25.0.0, 28.0.3, 29.0.0, 29.0.2 System Images: android-28 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64 npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.4 => 0.61.4 npmGlobalPackages: react-native-cli: 2.0.1 react-native: 0.61.2
Steps To Reproduce
- Add a
<TextInput />
component - Try to hide the keyboard from showing while still maintaining the ability to paste into it.
Describe what you expected to happen: There should be some way we can make iOS and Android behave the same for this.
Sample code:
<TextInput
onFocus={() => Keyboard.dismiss()}
autoFocus={true}
showSoftInputOnFocus={false}
placeholder={"Some sample text"}
/>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:26
- Comments:18 (2 by maintainers)
Top GitHub Comments
@stale fuck off stale bot. No one ever looked at this, but otherwise nothing is stale about this
try this solution i hope this will work for android and ios both…