1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import React, { FC } from 'react';
- import { Text, View } from 'react-native';
- import { Formik } from 'formik';
- import * as yup from 'yup';
- import { PageWrapper, Header, BigText, Button, Input } from '../../components/';
- import { styles } from './styles';
- import { useResetPasswordMutation } from '../../modules/auth/api/queries/use-post-reset-password';
- const ResetPasswordSchema = yup.object({
- email: yup.string().email().required()
- });
- const ResetPasswordScreen: FC = () => {
- const { data, error, mutate: resetPassword } = useResetPasswordMutation();
- return (
- <PageWrapper>
- <Header label={'Reset Password'} />
- <Formik
- initialValues={{
- email: ''
- }}
- onSubmit={({ email }) => {
- resetPassword({
- email
- });
- }}
- validationSchema={ResetPasswordSchema}
- >
- {(props) => (
- <>
- <View style={{ gap: 15 }}>
- <BigText>Please enter your valid email</BigText>
- <Text style={styles.smallText}>
- Type email which you used for registration and check your inbox for further
- instructions
- </Text>
- <Input
- header={'Email address'}
- placeholder={'Email'}
- inputMode={'email'}
- onChange={props.handleChange('email')}
- value={props.values.email}
- onBlur={props.handleBlur('email')}
- formikError={
- data?.result_description || (props.touched.email && props.errors.email)
- }
- />
- </View>
- <View style={{ marginTop: '10%' }}>
- <Button onPress={props.handleSubmit}>Send</Button>
- </View>
- </>
- )}
- </Formik>
- </PageWrapper>
- );
- };
- export default ResetPasswordScreen;
|