kuasha420 / react-native-paper-phone-number-input

A performant phone number input component for react-native-paper with country picker
MIT License
6 stars 1 forks source link

Limit Maximum Length for Input for Each Country #8

Closed ahmed-gelemli closed 1 month ago

ahmed-gelemli commented 1 month ago

This pull request introduces a maximum length restriction for the component. By setting a maximum length, we prevent users from entering excessively long and non-existent phone numbers, ensuring better data integrity and user experience. Each phone number's max length is defined inside src/data/countries.ts as length key. To give the input maxLength correctly, we are setting baselineLength which is length for flag and country code (🇦🇿 +994) and add it into the defined length.