Код: Выделить всё
import { StyleSheet, View, TouchableOpacity, ImageBackground } from 'react-native';
import { Text } from 'react-native-paper';
import { useNavigation } from '@react-navigation/native';
import { FormProvider, useForm } from 'react-hook-form';
import { loginValidateSchema } from '@utils/validation';
import { LoginSection } from './components/LoginSection';
import { zodResolver } from '@hookform/resolvers/zod';
import { useUserManagementApi } from '@service/UserManagementApi';
import { Button } from '@components/Button';
import { theme } from '@theme/theme';
import { Loading } from '@screens/loading/Loading';
import { ScreenNames } from '@router/CustomStack';
export type AuthenticationCredentials = {
email: string;
password: string;
};
const LoginForm = () => {
const methods = useForm({
resolver: zodResolver(loginValidateSchema),
});
const navigation = useNavigation();
const { loginUser } = useUserManagementApi();
const handleSubmitCredentials = methods.handleSubmit((values: AuthenticationCredentials) => {
loginUser.mutateAsync({ email: values.email, password: values.password });
});
return (
{loginUser.isPending ? (
) : (
Log in
navigation.navigate(ScreenNames.Registration)}>
Go to Registration
)}
);
};
const styles = StyleSheet.create({
buttonContainer: {
marginTop: 24,
marginHorizontal: 50,
gap: 10,
},
registration: {
textAlign: 'center',
color: theme.criticalColor.color,
marginTop: 10,
},
container: {
marginTop: 50,
marginHorizontal: 30,
gap: 10,
},
background: {
flex: 1,
width: "100%",
height:"100%"
},
});
export { LoginForm };
Подробнее здесь: https://stackoverflow.com/questions/782 ... ual-device