@@ -46,7 +46,9 @@ export default class PhoneInput extends Component {
46
46
47
47
componentDidUpdate ( ) {
48
48
const { value, disabled } = this . props ;
49
- this . setState ( { disabled } ) ;
49
+ if ( disabled != null && disabled !== this . state . disabled ) {
50
+ this . setState ( { disabled} ) ;
51
+ }
50
52
51
53
if ( value && value !== this . state . value ) {
52
54
this . setState ( { value } ) ;
@@ -211,23 +213,23 @@ export default class PhoneInput extends Component {
211
213
/>
212
214
</ View >
213
215
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 . shouldShowCountryPicker && < 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
+ /> }
231
233
</ View >
232
234
) ;
233
235
}
@@ -265,11 +267,13 @@ PhoneInput.propTypes = {
265
267
confirmText : PropTypes . string ,
266
268
confirmTextTextStyle : styleType ,
267
269
disabled : PropTypes . bool ,
268
- allowZeroAfterCountryCode : PropTypes . bool
270
+ allowZeroAfterCountryCode : PropTypes . bool ,
271
+ shouldShowCountryPicker : PropTypes . bool
269
272
} ;
270
273
271
274
PhoneInput . defaultProps = {
272
275
initialCountry : "us" ,
273
276
disabled : false ,
274
- allowZeroAfterCountryCode : true
277
+ allowZeroAfterCountryCode : true ,
278
+ shouldShowCountryPicker : true
275
279
} ;
0 commit comments