From 883a6c51d4c3e442df5e6c0f3dc6fada2f370f8e Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 26 Mar 2021 14:58:15 -0400 Subject: using university type --- src/screens/onboarding/OnboardingStepThree.tsx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/onboarding/OnboardingStepThree.tsx b/src/screens/onboarding/OnboardingStepThree.tsx index 120380c1..81f4dc97 100644 --- a/src/screens/onboarding/OnboardingStepThree.tsx +++ b/src/screens/onboarding/OnboardingStepThree.tsx @@ -26,11 +26,12 @@ import { ERROR_SELECT_BIRTHDAY, ERROR_SELECT_CLASS_YEAR, ERROR_SELECT_GENDER, + ERROR_SELECT_UNIVERSITY, ERROR_UPLOAD_SMALL_PROFILE_PIC, } from '../../constants/strings'; import {OnboardingStackParams} from '../../routes/onboarding'; import {patchEditProfile} from '../../services'; -import {BackgroundGradientType} from '../../types'; +import {BackgroundGradientType, UniversityType} from '../../types'; import {normalize, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type OnboardingStepThreeRouteProp = RouteProp< @@ -52,9 +53,10 @@ const OnboardingStepThree: React.FC = ({ }) => { const {userId, username} = route.params; let emptyDate: string | undefined; + let emptyUniversity: UniversityType | undefined; const [form, setForm] = React.useState({ smallPic: '', - university: '', + university: emptyUniversity, birthdate: emptyDate, gender: '', isValidGender: true, @@ -158,7 +160,7 @@ const OnboardingStepThree: React.FC = ({ Alert.alert(ERROR_SELECT_CLASS_YEAR); return; } - if (form.university === '') { + if (!form.university) { Alert.alert(ERROR_SELECT_UNIVERSITY); return; } @@ -243,12 +245,15 @@ const OnboardingStepThree: React.FC = ({ /> - { - setForm({ - ...form, - university: selected - }) - }}/> + { + setForm({ + ...form, + university: selected, + }); + }} + /> handleClassYearUpdate(value)} items={classYearList} -- cgit v1.2.3-70-g09d2