|
|
@ -1,5 +1,5 @@ |
|
|
|
import React, { useState, useContext } from "react"; |
|
|
|
import { StyleSheet, View, Text } from "react-native"; |
|
|
|
import { StyleSheet, View } from "react-native"; |
|
|
|
import * as Yup from "yup"; |
|
|
|
import { |
|
|
|
Form, |
|
|
@ -10,7 +10,6 @@ import { |
|
|
|
import Screen from "../components/Screen"; |
|
|
|
import colors from "../config/colors"; |
|
|
|
import { dimensions } from "../config/dimensions"; |
|
|
|
import { TouchableNativeFeedback } from "react-native-gesture-handler"; |
|
|
|
import login from "../api/auth"; |
|
|
|
import jwdDecode from "jwt-decode"; |
|
|
|
import { AuthContext } from "../auth/context"; |
|
|
@ -59,33 +58,42 @@ export default function LoginScreen(props) { |
|
|
|
handleSubmit(name, password, setLoginFailed) |
|
|
|
} |
|
|
|
> |
|
|
|
<assets.AppLogoTitle |
|
|
|
preserveAspectRatio="xMidYMid meet" |
|
|
|
width={300} |
|
|
|
height={30} |
|
|
|
alignSelf="center" |
|
|
|
marginBottom={dimensions.spacing.big_padding} |
|
|
|
/> |
|
|
|
<View> |
|
|
|
<assets.AppLogoTitle |
|
|
|
preserveAspectRatio="xMidYMid meet" |
|
|
|
width={300} |
|
|
|
height={30} |
|
|
|
alignSelf="center" |
|
|
|
marginBottom={dimensions.spacing.big_padding} |
|
|
|
/> |
|
|
|
|
|
|
|
<ErrorMessage error="Email ou senha inválidos" visible={loginFailed} /> |
|
|
|
<FormField |
|
|
|
maxLength={12} |
|
|
|
name="name" |
|
|
|
keyboardType="numeric" |
|
|
|
numberOfLines={1} |
|
|
|
placeholder="Número de telefone celular" |
|
|
|
/> |
|
|
|
<ErrorMessage |
|
|
|
error="Email ou senha inválidos" |
|
|
|
visible={loginFailed} |
|
|
|
/> |
|
|
|
|
|
|
|
<FormField |
|
|
|
maxLength={12} |
|
|
|
name="password" |
|
|
|
secureTextEntry={true} |
|
|
|
numberOfLines={1} |
|
|
|
placeholder="Senha" |
|
|
|
/> |
|
|
|
<View style={{ paddingVertical: 24 }}> |
|
|
|
<FormField |
|
|
|
maxLength={12} |
|
|
|
name="name" |
|
|
|
keyboardType="numeric" |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Número de telefone celular" |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<SubmitButton title="entrar" backgroundColor={colors.primary} /> |
|
|
|
<View style={{ paddingBottom: 24 }}> |
|
|
|
<FormField |
|
|
|
maxLength={12} |
|
|
|
name="password" |
|
|
|
secureTextEntry={true} |
|
|
|
numberOfLines={2} |
|
|
|
placeholder="Senha" |
|
|
|
/> |
|
|
|
</View> |
|
|
|
|
|
|
|
<SubmitButton title="entrar" backgroundColor={colors.primary} /> |
|
|
|
</View> |
|
|
|
{/* <TouchableNativeFeedback |
|
|
|
onPress={() => { |
|
|
|
props.navigation.navigate("Register"); |
|
|
@ -103,7 +111,6 @@ export default function LoginScreen(props) { |
|
|
|
|
|
|
|
const styles = StyleSheet.create({ |
|
|
|
containter: { |
|
|
|
padding: 10, |
|
|
|
justifyContent: "center", |
|
|
|
}, |
|
|
|
}); |