@@ -46,7 +46,9 @@ export default class PhoneInput extends Component {
4646
4747 componentDidUpdate ( ) {
4848 const { value, disabled } = this . props ;
49- this . setState ( { disabled } ) ;
49+ if ( disabled != null && disabled !== this . state . disabled ) {
50+ this . setState ( { disabled} ) ;
51+ }
5052
5153 if ( value && value !== this . state . value ) {
5254 this . setState ( { value } ) ;
@@ -211,23 +213,23 @@ export default class PhoneInput extends Component {
211213 />
212214 </ View >
213215
214- < CountryPicker
215- ref = { ref => {
216- this . picker = ref ;
217- } }
218- selectedCountry = { iso2 }
219- onSubmit = { this . selectCountry }
220- buttonColor = { this . props . pickerButtonColor }
221- buttonTextStyle = { this . props . pickerButtonTextStyle }
222- cancelText = { this . props . cancelText }
223- cancelTextStyle = { this . props . cancelTextStyle }
224- confirmText = { this . props . confirmText }
225- confirmTextStyle = { this . props . confirmTextStyle }
226- pickerBackgroundColor = { this . props . pickerBackgroundColor }
227- itemStyle = { this . props . pickerItemStyle }
228- onPressCancel = { this . props . onPressCancel }
229- onPressConfirm = { this . props . onPressConfirm }
230- />
216+ { this . props . shouldsShowCountryPicker && < CountryPicker
217+ ref = { ref => {
218+ this . picker = ref ;
219+ } }
220+ selectedCountry = { iso2 }
221+ onSubmit = { this . selectCountry }
222+ buttonColor = { this . props . pickerButtonColor }
223+ buttonTextStyle = { this . props . pickerButtonTextStyle }
224+ cancelText = { this . props . cancelText }
225+ cancelTextStyle = { this . props . cancelTextStyle }
226+ confirmText = { this . props . confirmText }
227+ confirmTextStyle = { this . props . confirmTextStyle }
228+ pickerBackgroundColor = { this . props . pickerBackgroundColor }
229+ itemStyle = { this . props . pickerItemStyle }
230+ onPressCancel = { this . props . onPressCancel }
231+ onPressConfirm = { this . props . onPressConfirm }
232+ /> }
231233 </ View >
232234 ) ;
233235 }
@@ -265,11 +267,13 @@ PhoneInput.propTypes = {
265267 confirmText : PropTypes . string ,
266268 confirmTextTextStyle : styleType ,
267269 disabled : PropTypes . bool ,
268- allowZeroAfterCountryCode : PropTypes . bool
270+ allowZeroAfterCountryCode : PropTypes . bool ,
271+ shouldsShowCountryPicker : PropTypes . bool
269272} ;
270273
271274PhoneInput . defaultProps = {
272275 initialCountry : "us" ,
273276 disabled : false ,
274- allowZeroAfterCountryCode : true
277+ allowZeroAfterCountryCode : true ,
278+ shouldsShowCountryPicker : true
275279} ;
0 commit comments