Next to my TextInput
, there is a button that increments its counter each time it's pressed.
<TouchableWithoutFeedback onPress={() => {this.increaseAmount(step, rowID)}}>
<View style={styles.amountPlusButtonContainer}>
<Text style={styles.amountButtonText}>+</Text>
</View>
</TouchableWithoutFeedback>
Currently, the counter goes up by 1 with every tap of the button. I want to change it so that the counter continues to increase as long as the user holds down the button.
I attempted to solve this issue by using setInterval()
, but I'm unsure of when to stop it or if this is the correct approach for this problem.