|
@@ -3,6 +3,7 @@ import { View, Text, ScrollView } from 'react-native';
|
|
import { NavigationProp } from '@react-navigation/native';
|
|
import { NavigationProp } from '@react-navigation/native';
|
|
import { Formik } from 'formik';
|
|
import { Formik } from 'formik';
|
|
import * as yup from 'yup';
|
|
import * as yup from 'yup';
|
|
|
|
+import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
|
|
|
|
import { PageWrapper, Header, Button, BigText, CheckBox, Input } from '../../../components';
|
|
import { PageWrapper, Header, Button, BigText, CheckBox, Input } from '../../../components';
|
|
import { NAVIGATION_PAGES } from '../../../types';
|
|
import { NAVIGATION_PAGES } from '../../../types';
|
|
@@ -37,89 +38,91 @@ const JoinUsScreen: FC<Props> = ({ navigation }) => {
|
|
<Header label={'Sign Up'} />
|
|
<Header label={'Sign Up'} />
|
|
<View style={{ gap: 15 }}>
|
|
<View style={{ gap: 15 }}>
|
|
<BigText>Join us. It's free!</BigText>
|
|
<BigText>Join us. It's free!</BigText>
|
|
- <Formik
|
|
|
|
- initialValues={{
|
|
|
|
- email: '',
|
|
|
|
- username: '',
|
|
|
|
- password: '',
|
|
|
|
- repeatPassword: '',
|
|
|
|
- checkboxAgreed: false
|
|
|
|
- }}
|
|
|
|
- validationSchema={JoinSchema}
|
|
|
|
- onSubmit={(values) => {
|
|
|
|
- const { email, username, password } = values;
|
|
|
|
|
|
+ <KeyboardAwareScrollView>
|
|
|
|
+ <Formik
|
|
|
|
+ initialValues={{
|
|
|
|
+ email: '',
|
|
|
|
+ username: '',
|
|
|
|
+ password: '',
|
|
|
|
+ repeatPassword: '',
|
|
|
|
+ checkboxAgreed: false
|
|
|
|
+ }}
|
|
|
|
+ validationSchema={JoinSchema}
|
|
|
|
+ onSubmit={(values) => {
|
|
|
|
+ const { email, username, password } = values;
|
|
|
|
|
|
- JoinTest({
|
|
|
|
- email,
|
|
|
|
- username
|
|
|
|
- }).then((data) => {
|
|
|
|
- if (!data?.field && data?.result === 'OK') {
|
|
|
|
- navigation.navigate(NAVIGATION_PAGES.REGISTER_ACCOUNT_DATA);
|
|
|
|
|
|
+ JoinTest({
|
|
|
|
+ email,
|
|
|
|
+ username
|
|
|
|
+ }).then((data) => {
|
|
|
|
+ if (!data?.field && data?.result === 'OK') {
|
|
|
|
+ navigation.navigate(NAVIGATION_PAGES.REGISTER_ACCOUNT_DATA);
|
|
|
|
|
|
- updateRegistrationUserData({ email, username, password });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- >
|
|
|
|
- {(props) => (
|
|
|
|
- <View style={{ gap: 15 }}>
|
|
|
|
- <Input
|
|
|
|
- onChange={props.handleChange('username')}
|
|
|
|
- value={props.values.username}
|
|
|
|
- onBlur={props.handleBlur('username')}
|
|
|
|
- placeholder={'Enter your username'}
|
|
|
|
- header={'Username'}
|
|
|
|
- formikError={
|
|
|
|
- data?.field === 'USERNAME USED'
|
|
|
|
- ? data?.field
|
|
|
|
- : props.touched.username && props.errors.username
|
|
|
|
|
|
+ updateRegistrationUserData({ email, username, password });
|
|
}
|
|
}
|
|
- />
|
|
|
|
- <Input
|
|
|
|
- onChange={props.handleChange('email')}
|
|
|
|
- value={props.values.email}
|
|
|
|
- onBlur={props.handleBlur('email')}
|
|
|
|
- placeholder={'Enter your email'}
|
|
|
|
- header={'Email address'}
|
|
|
|
- inputMode={'email'}
|
|
|
|
- formikError={
|
|
|
|
- data?.field === 'EMAIL USED'
|
|
|
|
- ? data?.field
|
|
|
|
- : props.touched.email && props.errors.email
|
|
|
|
- }
|
|
|
|
- />
|
|
|
|
- <Input
|
|
|
|
- onChange={props.handleChange('password')}
|
|
|
|
- value={props.values.password}
|
|
|
|
- onBlur={props.handleBlur('password')}
|
|
|
|
- placeholder={'Enter your password'}
|
|
|
|
- header={'Password'}
|
|
|
|
- isPrivate={true}
|
|
|
|
- formikError={props.touched.password && props.errors.password}
|
|
|
|
- />
|
|
|
|
- <Input
|
|
|
|
- onChange={props.handleChange('repeatPassword')}
|
|
|
|
- value={props.values.repeatPassword}
|
|
|
|
- onBlur={props.handleBlur('repeatPassword')}
|
|
|
|
- placeholder={'Repeat your password'}
|
|
|
|
- header={'Confirm password'}
|
|
|
|
- isPrivate={true}
|
|
|
|
- formikError={props.touched.repeatPassword && props.errors.repeatPassword}
|
|
|
|
- />
|
|
|
|
- <CheckBox
|
|
|
|
- label={'I accept NM Terms & Conditions'}
|
|
|
|
- onChange={(value) => props.setFieldValue('checkboxAgreed', value)}
|
|
|
|
- value={props.values.checkboxAgreed}
|
|
|
|
- />
|
|
|
|
- <Text>
|
|
|
|
- {props.touched.checkboxAgreed && props.errors.checkboxAgreed
|
|
|
|
- ? 'To use our service you need to agree'
|
|
|
|
- : null}
|
|
|
|
- </Text>
|
|
|
|
- <Button onPress={props.handleSubmit}>Continue</Button>
|
|
|
|
- </View>
|
|
|
|
- )}
|
|
|
|
- </Formik>
|
|
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
|
|
+ {(props) => (
|
|
|
|
+ <View style={{ gap: 15 }}>
|
|
|
|
+ <Input
|
|
|
|
+ onChange={props.handleChange('username')}
|
|
|
|
+ value={props.values.username}
|
|
|
|
+ onBlur={props.handleBlur('username')}
|
|
|
|
+ placeholder={'Enter your username'}
|
|
|
|
+ header={'Username'}
|
|
|
|
+ formikError={
|
|
|
|
+ data?.field === 'USERNAME USED'
|
|
|
|
+ ? data?.field
|
|
|
|
+ : props.touched.username && props.errors.username
|
|
|
|
+ }
|
|
|
|
+ />
|
|
|
|
+ <Input
|
|
|
|
+ onChange={props.handleChange('email')}
|
|
|
|
+ value={props.values.email}
|
|
|
|
+ onBlur={props.handleBlur('email')}
|
|
|
|
+ placeholder={'Enter your email'}
|
|
|
|
+ header={'Email address'}
|
|
|
|
+ inputMode={'email'}
|
|
|
|
+ formikError={
|
|
|
|
+ data?.field === 'EMAIL USED'
|
|
|
|
+ ? data?.field
|
|
|
|
+ : props.touched.email && props.errors.email
|
|
|
|
+ }
|
|
|
|
+ />
|
|
|
|
+ <Input
|
|
|
|
+ onChange={props.handleChange('password')}
|
|
|
|
+ value={props.values.password}
|
|
|
|
+ onBlur={props.handleBlur('password')}
|
|
|
|
+ placeholder={'Enter your password'}
|
|
|
|
+ header={'Password'}
|
|
|
|
+ isPrivate={true}
|
|
|
|
+ formikError={props.touched.password && props.errors.password}
|
|
|
|
+ />
|
|
|
|
+ <Input
|
|
|
|
+ onChange={props.handleChange('repeatPassword')}
|
|
|
|
+ value={props.values.repeatPassword}
|
|
|
|
+ onBlur={props.handleBlur('repeatPassword')}
|
|
|
|
+ placeholder={'Repeat your password'}
|
|
|
|
+ header={'Confirm password'}
|
|
|
|
+ isPrivate={true}
|
|
|
|
+ formikError={props.touched.repeatPassword && props.errors.repeatPassword}
|
|
|
|
+ />
|
|
|
|
+ <CheckBox
|
|
|
|
+ label={'I accept NM Terms & Conditions'}
|
|
|
|
+ onChange={(value) => props.setFieldValue('checkboxAgreed', value)}
|
|
|
|
+ value={props.values.checkboxAgreed}
|
|
|
|
+ />
|
|
|
|
+ <Text>
|
|
|
|
+ {props.touched.checkboxAgreed && props.errors.checkboxAgreed
|
|
|
|
+ ? 'To use our service you need to agree'
|
|
|
|
+ : null}
|
|
|
|
+ </Text>
|
|
|
|
+ <Button onPress={props.handleSubmit}>Continue</Button>
|
|
|
|
+ </View>
|
|
|
|
+ )}
|
|
|
|
+ </Formik>
|
|
|
|
+ </KeyboardAwareScrollView>
|
|
</View>
|
|
</View>
|
|
</ScrollView>
|
|
</ScrollView>
|
|
</PageWrapper>
|
|
</PageWrapper>
|