Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable return key in React Native TextInput

Tags:

react-native

I'm using React Native's TextInput. I noticed that enablesReturnKeyAutomatically makes the keyboard's return key disabled until some text is entered. Is there a way to control the disabled state of the return key myself?

like image 466
dmnd Avatar asked Jan 01 '16 22:01

dmnd


People also ask

How do I disable TextInput in react native?

Use caretHidden={true} if you want to disable all operation like Cut Paste Copy. It will also hide your cursor as well.

How do you clear TextInput in react native after submit?

To clear React Native TextInput, we can set the value with a state and clear the state. to set the value prop to val . And we set onChangeText to setVal to set val to the inputted value. Next, we add a Button with the onPress prop set to a function that set val to an empty string with setVal .

How do I make text not editable in react native?

Set editable false to read only TextInput.


1 Answers

Not at this time - This attribute maps directly into a UIKit attribute:

https://developer.apple.com/documentation/uikit/uitextinputtraits/1624432-enablesreturnkeyautomatically

I couldn't find any particular hooks in this API to manually manage the enabled/disabled state of the submit button either.

like image 87
fmoo Avatar answered Sep 17 '22 13:09

fmoo