aboutsummaryrefslogtreecommitdiff
path: root/src/screens
diff options
context:
space:
mode:
Diffstat (limited to 'src/screens')
-rw-r--r--src/screens/onboarding/ProfileOnboarding.tsx20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/screens/onboarding/ProfileOnboarding.tsx b/src/screens/onboarding/ProfileOnboarding.tsx
index e7fcec90..bbabbb56 100644
--- a/src/screens/onboarding/ProfileOnboarding.tsx
+++ b/src/screens/onboarding/ProfileOnboarding.tsx
@@ -1,5 +1,6 @@
import React from 'react';
import {RouteProp} from '@react-navigation/native';
+import moment from 'moment';
import {StackNavigationProp} from '@react-navigation/stack';
import {
Text,
@@ -16,6 +17,7 @@ import {
TaggInput,
TaggDatePicker,
TaggDropDown,
+ BirthDatePicker,
} from '../../components';
import {OnboardingStackParams} from '../../routes/onboarding';
import {AuthContext} from '../../routes/authentication';
@@ -26,7 +28,6 @@ import {
bioRegex,
genderRegex,
} from '../../constants';
-import moment from 'moment';
import AsyncStorage from '@react-native-community/async-storage';
type ProfileOnboardingScreenRouteProp = RouteProp<
@@ -228,18 +229,13 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({
});
};
- const handleBirthdateUpdate = (birthdate: string) => {
+ const handleBirthdateUpdate = (birthdate: Date) => {
setForm({
...form,
- birthdate,
+ birthdate: moment(birthdate).format('YYYY-MM-DD'),
});
};
- const getMaxDate = () => {
- const maxDate = moment().subtract(13, 'y').subtract(1, 'd');
- return maxDate.format('YYYY-MM-DD');
- };
-
const handleSubmit = async () => {
if (!form.largePic) {
Alert.alert('Please upload a large profile picture!');
@@ -396,10 +392,10 @@ const ProfileOnboarding: React.FC<ProfileOnboardingProps> = ({
}
width={280}
/>
- <TaggDatePicker
- date={form.birthdate}
- maxDate={getMaxDate()}
- onDateChange={(birthdate) => handleBirthdateUpdate(birthdate)}
+ <BirthDatePicker
+ ref={birthdateRef}
+ handleBDUpdate={handleBirthdateUpdate}
+ width={280}
/>
<TaggDropDown
onValueChange={(value) => handleGenderUpdate(value)}