aboutsummaryrefslogtreecommitdiff
path: root/src/components/onboarding/BirthDatePicker.tsx
diff options
context:
space:
mode:
authorShravya Ramesh <37447613+shravyaramesh@users.noreply.github.com>2020-11-17 18:06:14 -0800
committerGitHub <noreply@github.com>2020-11-17 21:06:14 -0500
commit713d169915a82edfcfe4b44622e3dce8c6adaf0c (patch)
tree3f0a0a9ef86e80442c4cc5b6b89be24cf1526268 /src/components/onboarding/BirthDatePicker.tsx
parent9b4ba92df514ca8c5c92c4f9279144e2c9d49e36 (diff)
[TMA-382] Edit profile screen (#121)
* added more icon * a less fat icon * and the actual icon asset * bottom drawer skeleton done * removed warning, better code * a more completed skeleton done * bottom drawer done! * Added content container, sent birthday picker props, minor styling * differenciating defined and undefined birthdate in birthdate, datepicker * removed restricting width for TaggDropDown * Added edit profile screen to navigator stack * Add EditProfile view, refresh profile view on save * Removes unnecessary import * Stores gender and birthdate as part of ProfileType * Added gender, birthdate, isEditProfile to AuthProv * Conditional view applied for edit profile button * Includes discarded changes in previous merge- BD * removed unused icon * resolved scary warnings * added icon to drawer * Small fix * minor code improvement * sc * fixed birthday bug * custom gender updation fixed * small change to birthday default value * missed something * cleaned up types! Warnings gone! * fixed another gender picker bug * fixed gender bug and cleaned up logic * removed warning, MUCH better code now Co-authored-by: Ivan Chen <ivan@thetaggid.com> Co-authored-by: Ashm Walia <ashmwalia@outlook.com>
Diffstat (limited to 'src/components/onboarding/BirthDatePicker.tsx')
-rw-r--r--src/components/onboarding/BirthDatePicker.tsx9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/components/onboarding/BirthDatePicker.tsx b/src/components/onboarding/BirthDatePicker.tsx
index f97f1a72..0fc597c3 100644
--- a/src/components/onboarding/BirthDatePicker.tsx
+++ b/src/components/onboarding/BirthDatePicker.tsx
@@ -15,6 +15,8 @@ import {TaggDatePicker} from '../common';
interface BirthDatePickerProps extends TextInputProps {
handleBDUpdate: (_: Date) => void;
width?: number | string;
+ date: Date | undefined;
+ showPresetdate: boolean;
}
const BirthDatePicker = React.forwardRef(
@@ -23,7 +25,7 @@ const BirthDatePicker = React.forwardRef(
const maxDate = moment().subtract(13, 'y').subtract(1, 'd');
return maxDate.toDate();
};
- const [date, setDate] = useState(new Date(0));
+ const [date, setDate] = useState(props.date);
const [hidden, setHidden] = useState(true);
const [updated, setUpdated] = useState(false);
const textColor = updated ? 'white' : '#ddd';
@@ -42,7 +44,9 @@ const BirthDatePicker = React.forwardRef(
style={[styles.input, {width: props.width}, {color: textColor}]}
ref={ref}
{...props}>
- {updated ? moment(date).format('YYYY-MM-DD') : 'Date of Birth'}
+ {(updated || props.showPresetdate) && date
+ ? moment(date).format('YYYY-MM-DD')
+ : 'Date of Birth'}
</Text>
</TouchableOpacity>
<Modal visible={!hidden} transparent={true} animationType="fade">
@@ -67,6 +71,7 @@ const BirthDatePicker = React.forwardRef(
handleDateUpdate={updateDate}
maxDate={getMaxDate()}
textColor={'black'}
+ date={date}
/>
</View>
</TouchableWithoutFeedback>