当有人按下某个按钮时,我试图增加/减少文本输入,但出现以下错误
代码
constructor (props) {
super(props)
this.state = {qty: 1};
}
<TextInput
style={styles.qtyValue}
value={this.state.qty}
keyboardType='number-pad'
defaultValue='1'
/>
<TouchableOpacity onPress={() => this.setState({qty: this.state.qty++})}>
<View style={styles.transparentButton}>
<Text>+</Text>
</View>
</TouchableOpacity>