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:
how to solve by using multiple useref? or
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.
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: