102 lines
3.6 KiB
Diff
102 lines
3.6 KiB
Diff
diff --git a/src/screens/Signup/StepInfo/index.tsx b/src/screens/Signup/StepInfo/index.tsx
|
|
--- a/src/screens/Signup/StepInfo/index.tsx
|
|
+++ b/src/screens/Signup/StepInfo/index.tsx
|
|
@@ -7,11 +7,9 @@
|
|
|
|
import {isEmailMaybeInvalid} from '#/lib/strings/email'
|
|
import {logger} from '#/logger'
|
|
-import {is13, is18, useSignupContext} from '#/screens/Signup/state'
|
|
+import {useSignupContext} from '#/screens/Signup/state'
|
|
import {Policies} from '#/screens/Signup/StepInfo/Policies'
|
|
import {atoms as a, native} from '#/alf'
|
|
-import * as DateField from '#/components/forms/DateField'
|
|
-import {type DateFieldRef} from '#/components/forms/DateField/types'
|
|
import {FormError} from '#/components/forms/FormError'
|
|
import {HostingProvider} from '#/components/forms/HostingProvider'
|
|
import * as TextField from '#/components/forms/TextField'
|
|
@@ -22,16 +20,6 @@
|
|
import {usePreemptivelyCompleteActivePolicyUpdate} from '#/components/PolicyUpdateOverlay/usePreemptivelyCompleteActivePolicyUpdate'
|
|
import {BackNextButtons} from '../BackNextButtons'
|
|
|
|
-function sanitizeDate(date: Date): Date {
|
|
- if (!date || date.toString() === 'Invalid Date') {
|
|
- logger.error(`Create account: handled invalid date for birthDate`, {
|
|
- hasDate: !!date,
|
|
- })
|
|
- return new Date()
|
|
- }
|
|
- return date
|
|
-}
|
|
-
|
|
export function StepInfo({
|
|
onPressBack,
|
|
isServerError,
|
|
@@ -55,7 +43,6 @@
|
|
|
|
const emailInputRef = useRef<TextInput>(null)
|
|
const passwordInputRef = useRef<TextInput>(null)
|
|
- const birthdateInputRef = useRef<DateFieldRef>(null)
|
|
|
|
const [hasWarnedEmail, setHasWarnedEmail] = React.useState<boolean>(false)
|
|
|
|
@@ -76,10 +63,6 @@
|
|
const emailChanged = prevEmailValueRef.current !== email
|
|
const password = passwordValueRef.current
|
|
|
|
- if (!is13(state.dateOfBirth)) {
|
|
- return
|
|
- }
|
|
-
|
|
if (state.serviceDescription?.inviteCodeRequired && !inviteCode) {
|
|
return dispatch({
|
|
type: 'setError',
|
|
@@ -246,44 +229,21 @@
|
|
secureTextEntry
|
|
autoComplete="new-password"
|
|
autoCapitalize="none"
|
|
- returnKeyType="next"
|
|
- submitBehavior={native('blurAndSubmit')}
|
|
- onSubmitEditing={native(() =>
|
|
- birthdateInputRef.current?.focus(),
|
|
- )}
|
|
+ returnKeyType="done"
|
|
passwordRules="minlength: 8;"
|
|
/>
|
|
</TextField.Root>
|
|
</View>
|
|
- <View>
|
|
- <DateField.LabelText>
|
|
- <Trans>Your birth date</Trans>
|
|
- </DateField.LabelText>
|
|
- <DateField.DateField
|
|
- testID="date"
|
|
- inputRef={birthdateInputRef}
|
|
- value={state.dateOfBirth}
|
|
- onChangeDate={date => {
|
|
- dispatch({
|
|
- type: 'setDateOfBirth',
|
|
- value: sanitizeDate(new Date(date)),
|
|
- })
|
|
- }}
|
|
- label={_(msg`Date of birth`)}
|
|
- accessibilityHint={_(msg`Select your date of birth`)}
|
|
- maximumDate={new Date()}
|
|
- />
|
|
- </View>
|
|
<Policies
|
|
serviceDescription={state.serviceDescription}
|
|
- needsGuardian={!is18(state.dateOfBirth)}
|
|
- under13={!is13(state.dateOfBirth)}
|
|
+ needsGuardian={false}
|
|
+ under13={false}
|
|
/>
|
|
</>
|
|
) : undefined}
|
|
</View>
|
|
<BackNextButtons
|
|
- hideNext={!is13(state.dateOfBirth)}
|
|
+ hideNext={false}
|
|
showRetry={isServerError}
|
|
isLoading={state.isLoading}
|
|
onBackPress={onPressBack}
|