How to make TouchableOpacity button to prevent multiple clicks
问题 I have TouchableOpacity with event that I don't want to execute twice. I tried to put in it's onPress event bool in state but this doesn't work as setting state is async and I can press button multiple times fast. I also tried to set timer but this also doesn't work for me. Is there any other way to prevent multiple press on button (some other similar component etc.)? 回答1: You do not need to setState to store values which do not reflect as UI changes. You could directly have a this.flag