i want keyboard not to show up at all when i touch my text input-React-Native

Viewed 10219

I want keyboard not to show up at all when i touch my text input.If i use 'Keyboard.dismiss' i loose the focus on my text input i am using custom keyboard which itself is part of my screen so i don't want any keyboard to show up at all without loosing the focus on my text input, any solution please.I have tried using libraries but facing same problems again and again what should i do. Here the code i Am using

<TextInput onFocus={Keyboard.dismiss}>

enter image description here

3 Answers

Use <TextInput showSoftInputOnFocus={false} /> It will hide the keyboard when you focus on the text input.

ReactNative TextInput has showSoftInputOnFocus prop, which is due to docs should hide keyboard. But seems like it doesn't work.

I found this solution, works for me:

 <>
<TouchableWithoutFeedback onPress={this.toggleVisible}>
  <View>
    <View pointerEvents="none">
      <Input
        value={String(value)}
        placeholder={placeholder}
      />
    </View>
  </View>
</TouchableWithoutFeedback>
<DateTimePicker
  isVisible={this.state.visible}
  onConfirm={onChange}
  onCancel={this.toggleVisible}
/>

Related