Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catch tap in React Native ScrollView while keyboard is up

Tags:

react-native

Is it possible to catch taps on a React Native ScrollView while the keyboard is up? Or any React Native container for that matter?

I see the ScrollView property keyboardShouldPersistTaps and keyboardDismissMode that allows some control of how taps are handled while the keyboard is up. But no combination seems to allow taps to be handled normally.

The use case is a search field where the search is updated on keypress. When the entry appears in the list below the input, and the user taps it, I want the app to react to that tap. Right now it just dismissed the keyboard and the user has to tap again.

like image 648
nicholas Avatar asked Feb 01 '16 02:02

nicholas


2 Answers

Looks like I answered my own question; setting keyboardShouldPersistTaps to 'always' or 'handled' on a ScrollView will pass taps to the components in that ScrollView even when the keyboard is up.

like image 121
nicholas Avatar answered Sep 23 '22 16:09

nicholas


You need to add the keyboardShouldPersistTaps to 'always' on your list too.

Check out this answer:

https://stackoverflow.com/a/42815548/2887460

like image 32
andrewster Avatar answered Sep 20 '22 16:09

andrewster