2

I am working with address select screen, and I want when I click to select the keyboard will disappear and the item I clicked will be "selected" but now when I select it just disappear the keyboard and the item I selected stays not in "selected" state but I have to click 1 more time. enter image description here

Hope to get a solution from everyone!

1 Answers1

0

Wrap your component inside ScrollView, or Use Pressable, like this:

import {Keyboard, Pressable} from 'react-native'

And after that wrap your component like this:

<Pressable style={{flex: 1}} onPress={Keyboard.dismiss}>
      ...rest of the components 

Solution 2: Use ScrollView: wrap your component inside ScrollView and use prop:

keyboardShouldPersistTaps

<ScrollView keyboardShouldPersistTaps="never" />

The same are already shared at this StackoverFlow

If you find this answer useful, please upvote, thanks, writing from my Android on Vacations, Happy Coding ♥️

Anwer Solangi
  • 148
  • 3
  • 9