I have a calculator app with a lot of buttons (TouchableOpacity’s), and the problem occurs when the user presses a lot of the buttons very fast after each other: The first button press may get handled, however the other button presses will get ignored as the delay on the onPress event is too high. How do I remove that delay so that the onpress event gets fired instantly?
<TouchableOpacity
activeOpacity={0.7}
onPress={() => console.log("test")}
>
This is a button
</TouchableOpacity>
I also tried using TouchableWithoutFeedback, Pressable, as well as the onPressIn, pressInDelay properties which also did not remove the delay
2
Answers
React Native’s TouchableOpacity has a built-in delay to prevent multiple touches. You can try to disable it using the delayPressIn prop:
Try below maybe work:
Use a different touchable component: TouchableWithoutFeedback
might be more responsive for your use case.