From 9249b76c1d6b009d94c60b458ccc49db3b7db0a5 Mon Sep 17 00:00:00 2001 From: Farhad Yasir Date: Wed, 13 Feb 2019 07:31:10 +1100 Subject: [PATCH] fix(allowDropdown): allowdropdown updated after mount --- src/components/IntlTelInput.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/IntlTelInput.js b/src/components/IntlTelInput.js index 45a0deea1..2c584f6e9 100644 --- a/src/components/IntlTelInput.js +++ b/src/components/IntlTelInput.js @@ -156,6 +156,10 @@ class IntlTelInput extends Component { ) { this.updatePlaceholder(this.props); } + + if (this.props.allowDropdown !== prevProps.allowDropdown) { + this.allowDropdown = this.props.allowDropdown; + } } componentWillUnmount() { @@ -997,7 +1001,6 @@ class IntlTelInput extends Component { }; generateMarkup = () => { - this.wrapperClass['allow-dropdown'] = this.allowDropdown; this.wrapperClass['separate-dial-code'] = this.props.separateDialCode; if (this.isMobile && this.props.useMobileFullscreenDropdown) { @@ -1249,6 +1252,7 @@ class IntlTelInput extends Component { const inputClass = this.props.inputClassName; const wrapperStyle = Object.assign({}, this.props.style || {}); + this.wrapperClass['allow-dropdown'] = this.allowDropdown; this.wrapperClass.expanded = this.state.showDropdown; const wrapperClass = classNames(this.wrapperClass);