From e9c8ba79155f8557aab29f1ac4a185c0a9d01aaa Mon Sep 17 00:00:00 2001 From: Kamal Joshi Date: Thu, 7 Mar 2024 09:56:49 +0530 Subject: [PATCH] update sdk version and minor refactoring --- android/build.gradle | 4 ++-- screens/LoginScreen.js | 20 +++++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d1f9c573..fdc5bc1d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,8 +4,8 @@ buildscript { ext { buildToolsVersion = "30.0.2" minSdkVersion = 21 - compileSdkVersion = 31 - targetSdkVersion = 31 + compileSdkVersion = 33 + targetSdkVersion = 33 ndkVersion = "21.4.7075529" androidXAnnotation = "1.1.0" androidXBrowser = "1.0.0" diff --git a/screens/LoginScreen.js b/screens/LoginScreen.js index 2f6c9a88..5ca54df3 100644 --- a/screens/LoginScreen.js +++ b/screens/LoginScreen.js @@ -53,31 +53,25 @@ function checkValidEmail(email) { } function signUpValidations({ fullName, email, password, confirmPassword }) { - let fullNameError, emailError, passwordError; + const errors = {}; if (!fullName || fullName.length === 0) { - fullNameError = 'Full name required.'; + errors.fullName = 'Full name required.'; } if (!email || !checkValidEmail(email)) { - emailError = 'Please enter valid email.'; + errors.email = 'Please enter a valid email.'; } if (!password || password.length < 6) { - passwordError = 'Minimum 6 characters required in password.'; + errors.password = 'Minimum 6 characters required in password.'; } if (password !== confirmPassword) { - passwordError = 'Confirm password did not match.'; + errors.password = 'Confirm password did not match.'; } - if (!fullNameError && !emailError && !passwordError) { - return undefined; - } - return { - fullName: fullNameError, - email: emailError, - password: passwordError - }; + + return Object.keys(errors).length > 0 ? errors : {}; } function LoginScreen(props) {