From d4cf8c7ae63c47e2ffbd2b54ce85fa51908db8cb Mon Sep 17 00:00:00 2001 From: Siyahul Haq <76936407+siyahulhaq-ceymox@users.noreply.github.com> Date: Sat, 20 Aug 2022 16:09:14 +0530 Subject: [PATCH] fixed:- If value prop changes input field not updating --- lib/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/index.js b/lib/index.js index b89c388..ba61240 100644 --- a/lib/index.js +++ b/lib/index.js @@ -48,6 +48,12 @@ export default class PhoneInput extends PureComponent { } } + componentDidUpdate(prevProps) { + if (prevProps.value !== this.props.value) { + this.setState({number: this.props.value}); + } + } + getCountryCode = () => { return this.state.countryCode; };