Skip to content

Commit

Permalink
Pasamos el parametro por form
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisParedes1 committed Nov 30, 2023
1 parent 3865fa3 commit 3e171f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/screens/login/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as z from 'zod';
import { Image, TouchableOpacity } from '@/ui';
import { Button, ControlledInput, Text, View } from '@/ui';
import { useNavigation } from '@react-navigation/native';
import { ResetFormProps } from './recover-password-screen';

const schema = z.object({
name: z.string().optional(),
Expand All @@ -28,7 +29,6 @@ export type LoginFormProps = {
onLogInSubmit?: SubmitHandler<FormType>;
onSignUpSubmit?: SubmitHandler<FormType>;
onLogInGoogleSubmit?: () => void;
onResetSubmit?: SubmitHandler<FormType>;
};

export const LoginForm = ({
Expand Down
7 changes: 5 additions & 2 deletions src/screens/login/login-navigator.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import * as React from 'react';
import { RecoverPasswordScreen } from './recover-password-screen';
import { FormType, RecoverPasswordScreen } from './recover-password-screen';
import Login from '.';
import { SubmitHandler } from 'react-hook-form';

export type LoginStackParamList = {
Login: undefined;
RecoverPasswordScreen: { email: string };
RecoverPasswordScreen: {
email: string;
};
};

const Stack = createNativeStackNavigator<LoginStackParamList>();
Expand Down
11 changes: 7 additions & 4 deletions src/screens/login/recover-password-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import * as z from 'zod';
import { SubmitHandler, useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';

const onResetSubmit: ResetFormProps['onResetSubmit'] = (data) => {
console.log('Entre aca');
console.log(data);
};

const schema = z.object({
email: z
.string({
Expand All @@ -20,9 +25,7 @@ export type ResetFormProps = {
onResetSubmit?: SubmitHandler<FormType>;
};

export const RecoverPasswordScreen = ({
onResetSubmit = () => {},
}: ResetFormProps) => {
export const RecoverPasswordScreen = () => {
const route =
useRoute<RouteProp<LoginStackParamList, 'RecoverPasswordScreen'>>();
const { email } = route.params;
Expand Down Expand Up @@ -51,7 +54,7 @@ export const RecoverPasswordScreen = ({
<Button
testID="login-button"
label="Login with Google"
onPress={() => handleSubmit(onResetSubmit)}
onPress={handleSubmit(onResetSubmit)}
variant="primary"
/>

Expand Down

0 comments on commit 3e171f0

Please sign in to comment.