thegamenicorus / react-native-phone-input

Phone input box for React Native
https://www.npmjs.com/package/react-native-phone-input
MIT License
394 stars 447 forks source link

Country code disappear on input #110

Open JordanProtin opened 5 years ago

JordanProtin commented 5 years ago

From few days ago, country code doesn't appear on phone input :

Capture d’écran 2019-07-10 à 11 14 10

Is this bug in relation with the new release ?

My package.json contains "react-native-phone-input": "^0.2.1"

EDIT : reproduce code

selectCountry = (country) => {
  this.phone.selectCountry(country.iso2);
}
<PhoneInput
  ref={ref => { this.phone = ref }}
  onPressFlag={this.onPressFlag}
  countriesList={Countries}
  textStyle={{ color: 'black' }}
  initialCountry='fr'
  value={value}
  onChangePhoneNumber={this.handleOnChangePhoneNumber}
  textProps={{
    returnKeyType: returnKeyType,
    keyboardType: "numbers-and-punctuation",
    onSubmitEditing: onSubmitEditing,
    blurOnSubmit: blurOnSubmit
  }}
/>
<ModalCountrySelector
  ref={ref => { this.myCountryPicker = ref }}
  data={pickerData}
  onChange={country => { this.selectCountry(country) }}
  cancelText={ I18n.t('actions.cancel') }
  pickerButtonColor='red'
/>
mateattilabarna commented 5 years ago

Hi,

This bug is also observed with the version 0.2.4, using the Custom Library Picker example from the Readme: https://github.com/thegamenicorus/react-native-phone-input/blob/master/examples/CustomLibraryPicker/app.js

mohmdalfaha commented 5 years ago

I was having the same issue with version 0.2.4, so I have downgraded to the most recent stable version which is 0.2.2. In your case @JordanProtin , I think the issue is related to textProps.

simonasdev commented 5 years ago

I think it is after merge of #102 where a new state variable was introduced and passed to to TextInput value prop, although it is not being set correctly

affanhashone commented 5 years ago

@mohmdalfaha its not appearing on 0.2.2 also

simonasdev commented 5 years ago

it is appearing on 0.2.2. Commit fc938a603411bba3f4ee58de391b31b52d7f594c

affanhashone commented 5 years ago

@simonasdev I checked on this, country code not appearing on this

affanhashone commented 5 years ago

@simonasdev I reset my cache, its appearing

ziaulrehman40 commented 5 years ago

We also downgraded to 0.2.2 because of this inconsistency.

Abdulrahman-Khalid commented 5 years ago

I'm using the example model, I downgraded to 0.2.2 and reset the cache but still not working for me

affanhashone commented 5 years ago

Remove the module then reinstall it again

Abdulrahman-Khalid commented 5 years ago

@affanhashone It worked, Thanks

zgajo commented 4 years ago

After downgrade to 0.2.2 , run npm start -- --reset-cache