1

The following code works fine on iOS

<TextInput pointerEvents={"none"} value={textValue2} onPress={something}></TextInput>

But on android it would seem that pointerEvents isnt supported.

I tried wrapping the TextInput around a TouchableOpacity but sadly (albeit reasonably) focus is still given to it when pressed. Is there anyway i can detect the press without triggering the focus? Other props i've tried that didnt work:

editable={false} selectTextOnFocus={false}

1
  • One simple hack could be to add a transparent view on top of this textInput and handle onClick of the transparent view as required. Commented Sep 24, 2018 at 3:50

1 Answer 1

5
You can use Keyboard API. import { Keyboard, TextInput } from 'react-native'; <TextInput onSubmitEditing={Keyboard.dismiss} /> 

Please see the full example in react native offical document.

Sign up to request clarification or add additional context in comments.

1 Comment

Doesnt seem to work, additionally tried the same with onFocus but nada

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.