我有2个TextInput,我想将值存储在我的状态:
<CustomInput
underlineColorAndroid="#58CAF1"
style={styles.inputScheduleTime}
// ref="lundiStart"
placeholder="18H00..."
keyboardType="numeric"
onChangeText={ input2 => {
this.setState({ monday: {
start: this.state.monday.start,
end:this.state.monday.end + ':' + input2 }
});
console.log(this.state.monday)
}
}
/>
这是我输入的屏幕截图:
我首先输入9然后输入00然后输入10,最后输入00
我有这样的控制台日志,input4是第四个和最后一个输入:
<CustomInput
underlineColorAndroid="#58CAF1"
style={styles.inputScheduleTime}
// ref="lundiStart"
placeholder="18H00..."
keyboardType="numeric"
onChangeText={ input4 => {
console.log("input4 : " + input4);
this.setState({ monday: {
start: this.state.monday.start,
end:this.state.monday.end + ':' + input4 }
});
console.log("start : " + this.state.monday.start);
console.log("end : " + this.state.monday.end);
}
}
/>
和我的控制台日志:
我不明白为什么? 也许是我设定国家的方式?