React-Native textInput and firebase concatenation

2019-09-01 03:43发布

I have 2 TextInput and i want to store the value in my state :

                <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)
                  }
                }
                />

When i store the value of my input, he store the value but add a 0 between..... : enter image description here

this is a screenshot of my input:

enter image description here

I start by typing 9 then 00 then 10 and finally 00
i had console log like that, input4 being the fourth and last input :

         <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);
          }
        }
        />

and the log of my console :

enter image description here

I don't understand why ?? maybe my way of set the state?

0条回答
登录 后发表回答