Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native TextInput blur consumes TouchableHighlight press event

I have a <TextInput> that I'd like to submit when I tap the red Post button, a <TouchableHighlight>. When the TextInput is focused, I finish typing and I tap on the Post button, the keyboard closes but the button doesn't register the tap.

I tried using the TextInput onBlur event, but It doesn't give me the coordinates of the touch point, so I don't know if the touch point is actually over the button or not.

screenshot

like image 711
frank Avatar asked Feb 22 '16 00:02

frank


1 Answers

You need to add the property keyboardShouldPersistTaps={true} to your ScrollView.

Here is what the docs say :

keyboardShouldPersistTaps bool:

When false, tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When true, the scroll view will not catch taps, and the keyboard will not dismiss automatically. The default value is false.

like image 196
G. Hamaide Avatar answered Oct 04 '22 01:10

G. Hamaide