Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you disable fullscreen editing in landscape in React Native Android?

In an EditText Android element you can prevent the "fullscreen editing mode" from activating in landscape with android:imeOptions="flagNoExtractUi" (as detailed here).

Is there any way to replicate the same behavior with a React Native TextInput component? I've searched through the docs and StackOverflow and have not found a solution.

like image 850
Nate Avatar asked Sep 26 '16 21:09

Nate


2 Answers

Starting from v0.40.0 React Native's TextInput has the prop disableFullscreenUI, which sets imeOptions="flagNoExtractUi" internally.

<TextInput disableFullscreenUI={true} />

like image 50
olegweb Avatar answered Sep 21 '22 18:09

olegweb


One solution would be to write a custom native component and bind it to your React Native project. You would basically create a custom EditText that either has imeOptions set by default to android:imeOptions="flagNoExtractUi" or for a more dynamic behavior you can create a setter in your custom EditText and expose it using @ReactProp. This way you would be able to set it through the component's props from your React Native project.

Writing a custom UI component (especially a simple one like this) is pretty straight forward and much easier than it may sound. There's a decent documentation and plenty of tutorials out there.

Hope this helps.

like image 27
Georgios Avatar answered Sep 21 '22 18:09

Georgios