Skip to content

Commit b9235f2

Browse files
committed
Simplifies email validation
1 parent f0e1bef commit b9235f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/src/js/feedback/FeedbackForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
3939
return;
4040
}
4141

42-
if (config.isEmailRequired && !this._isValidEmail(trimmedEmail)) {
42+
if ((config.isEmailRequired || trimmedEmail.length > 0) && !this._isValidEmail(trimmedEmail)) {
4343
Alert.alert(text.errorTitle, text.emailError);
4444
return;
4545
}
@@ -115,7 +115,7 @@ export class FeedbackForm extends React.Component<FeedbackFormProps, FeedbackFor
115115
}
116116

117117
private _isValidEmail = (email: string): boolean => {
118-
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
118+
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
119119
return emailRegex.test(email);
120120
};
121121
}

0 commit comments

Comments
 (0)