react-native-phone-number-input
react-native-phone-number-input copied to clipboard
How to handle the validation and getCallingCode if we use multiple phoneInput in single page
Scenerio : Usually, we can validate the phonenumber & country code with help of UseRef of the phone input component. In my case, its dynamic based on the user selection, it will create a number of phoneInput boxes. That time, if the user changed different country code and number means it is validating with last changed countrycode with other phone number.
Problem faced: isvalidNumber & getcallingcode not properly working if multiple phone input boxes.
Expecting: 1. how to solve by using multiple useref? or 2. Any suggestion to validate and get the calling code?
I have handled this by putting React-Native-Phone-Number-Input within a component with it's own refs and state. Then you can dynamically render multiple of those parent components.