AstrOOnauta / react-native-international-phone-number

⚛️ International mobile phone number input component for React Native 📱
https://snack.expo.dev/@astroonauta/react-native-international-phone-number
ISC License
279 stars 52 forks source link

onChangePhoneNumber called with empty string on first render #87

Closed dufourgilles closed 1 month ago

dufourgilles commented 1 month ago

When PhoneInput is rendered the first time, it does emit a onChangePhoneNumber(''). This is caught by my React component which then believes the input was reset. This comes from code at line 244 of lib/index.js ... commenting that line does fix the issue. Any reason for that line ?

image

AstrOOnauta commented 1 month ago

Hello @dufourgilles this is how the lib work at the moment. It force the input field empty on the start, if you dont use a default value.