evblurbs / react-native-md-textinput

React Native TextInput styled with Material Design.
322 stars 122 forks source link

TextField.js - componentWillReceiveProps - Changing this.props.text t… #32

Open giladartzi opened 8 years ago

giladartzi commented 8 years ago

…o this.state.text

The scenario is like so:

  1. TextField is focused, but does not have a value.
  2. props are changing
  3. componentWillReceiveProps is triggered, and it's comparing this.props.text to this.props.value.
  4. this.props.text is undefined and does not equal this.props.value which is an empty string
  5. sinkLabel function is called, but TextField is still focused. (This is the issue)

In my opinion, text value should be read from the state and not the props.

Please let me know what you think :-)