Skip to content

Updated value not reflected in field #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ajmas opened this issue Apr 17, 2017 · 1 comment
Open

Updated value not reflected in field #40

ajmas opened this issue Apr 17, 2017 · 1 comment

Comments

@ajmas
Copy link
Contributor

ajmas commented Apr 17, 2017

While you can set the default value via:

<ReactPhoneInput value="..." />

There is an issue in that if you change the state of the component it is in then it won't get the updated value. It would appear a change need to be made to componentWillReceiveProps() function to accept an update value.

Expectation is that the number in the field, in the example below, will end up being "+33 4 93 42 64 90":

class MyView extends Component {

   constructor(props) {
      super(props);

      this.state({
          phone: "+1 514 275 8981"
      });
   }

   componentWillMount() {
      this.setState({
        phone: "+33 4 93 42 64 90"
     });
   }

   render() {
      return <ReactPhoneInput value={this.state.phone} />
   }
}
@Abdizriel
Copy link

@razagill could you please merge that pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants