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