OnPress Function Fires only after Tapping Twice when Keyboard Present React Native Issue Fix

By Rashid •  Updated on: January 9th, 2023 • 

This is a common react native issue especially when you use TextInput with ScrollView / FlatList as a parent. In such cases, the other components like the button respond only when you click or tap outside of the TextInput twice.

To solve this React Native issue, you have to use the keyboardShouldPersistTaps prop with ScrollView or FlatList. Then you only need to tap once outside of the TextInput.

Add keyboardShouldPersistTaps=’always’ to ScrollView or FlatList and then children of the ScrollView can catch the taps.

For more information, you can go through the official document on keyboardShouldPersistTaps.

I hope this short react native tutorial is helpful for you.

Rashid

Keep Reading