React Native - Disable soft keyboard permanently on Android -


is possible not show soft keyboard when textinput gets focused? use case need hide keyboard (for example when use external keyboard) need retain focus on textinput can use (see caret , so).

i don't hacking libs, looked inside textinput folder in react-native package , found files thought relevant. first one:

https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/reactandroid/src/main/java/com/facebook/react/views/textinput/reacttextinputmanager.java#l96

i replaced code on line 96 this:

edittext.setinputtype(inputtype.type_null); edittext.settextisselectable(true);

but unfortunately didn't work.

then found file:

https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/reactandroid/src/main/java/com/facebook/react/views/textinput/reactedittext.java#l215

and commented out line 215, again, didn't help.

could point me in correct direction how done? thanks.

you can setting flag on mainactivity in /android part of project.

open androidmanifest.xml file app/src/main , under mainactivity change:

  <activity     android:name=".mainactivity"     android:label="@string/app_name"     android:configchanges="keyboard|keyboardhidden|orientation|screensize"     android:windowsoftinputmode="adjustresize"> 

to this

  <activity     android:name=".mainactivity"     android:label="@string/app_name"     android:configchanges="keyboard|keyboardhidden|orientation|screensize"     android:windowsoftinputmode="statehidden"> 

that should disable keyboard permanently activity, in general case bulk of react native app on android. more information see: https://developer.android.com/guide/topics/manifest/activity-element.html#wsoft


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -