evblurbs/react-native-md-textinput

onChangeText doesn't update the TextInput value.

jojonarte opened this issue · 2 comments

Here's a snippet .
I'm having this issue:
I have this code that modifies the text and also validates if it is a valid phone number and formats it with "-" concat. The state successfully stores the new value through setState inside the function but even if the state is updated the UI display on the component doesn't change. :(

`

renderPhoneNumber(){
      var phone_number = this.state.phone_number;
        return(
            <View style={styles.inputLine}>
                <TextField
                    maxLength={10}
                    ref="phone_number"
                    style={styles.inputTextField}
                    label={'Phone'}
                    highlightColor={'#8CC641'}
                    dense={true}
                    borderColor="#E0E0E0"
                    duration= {500}
                    autoCorrect={false}
                    autoFocus={true}
                    keyboardType='numbers-and-punctuation'
                    value={phone_number}
                    onChangeText={(phone_number) => this._validatePhone(phone_number)}
                    onSubmitEditing={() => {
                                        this._getCustomerByPhonenumber()
                                      }}
                    returnKeyType='next'
                    />
            </View>
        )
    }

`

Are you using version 2.0.2? I merged in pull request #3 to handle updates when new props are received.

Thanks I got it.