react-native-ui-lib
react-native-ui-lib copied to clipboard
fix: Allow empty strings for email and number validation in validators.ts
Description
Updated the email and number validators in validator.ts to allow empty strings. Now, empty email and number strings are considered valid.
Motivation
issue #2807
Changelog
- Modified the
emailvalidator logic to allow empty strings explicitly. - Modified the
numbervalidator logic to consider empty strings as valid.
Additional info
This change ensures a more permissive validation for both email and number fields. If a field is not required, no error message will be displayed when users clear their input. If you encounter any issues or have further suggestions, please let me know.
Results
| 1. Invalid Email | 2. Invalid Number |
| 1. Email Cleared | 2. Number Cleared |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Thank you! @Inbal-Tish @adids1221 could you please take a peek whenever able 🙏 ? This one has been open for a few months now
Left another small comment since it could be a breaking change to other users that are using this validation even though the
changes are made as per the suggestion