When i press an input in react-native , the keyboard pops an opens. I would like to close the keyboard (ONLY) when pressing some button. How can i do this?
1 Answer
You can dismiss the keyboard by using Keyboard.dismiss.
import { Keyboard } from 'react-native'; <Touchable onPress={Keyboard.dismiss}>...</Touchable> If you're using a ScrollView you'll need to set keyboardShouldPersistTaps prop to true.
3 Comments
Vandervidi
Working perfectly!
panurg
@oblador did you mean this one: react-native-dismiss-keyboard when you wrote from 'dismissKeyboard'?
Aldor
What if we are using a FlatList inside ?