|
@ -10,9 +10,9 @@ import Screen from "../components/Screen"; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
import colors from "../config/colors"; |
|
|
import colors from "../config/colors"; |
|
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; |
|
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; |
|
|
|
|
|
import assets from "../config/assets"; |
|
|
import * as Yup from "yup"; |
|
|
import * as Yup from "yup"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const phoneRegex = RegExp( |
|
|
const phoneRegex = RegExp( |
|
|
/^\(?[\(]?([0-9]{2})?\)?[)\b]?([0-9]{4,5})[-. ]?([0-9]{4})$/ |
|
|
/^\(?[\(]?([0-9]{2})?\)?[)\b]?([0-9]{4,5})[-. ]?([0-9]{4})$/ |
|
|
); |
|
|
); |
|
@ -34,20 +34,17 @@ const validationSchema = Yup.object().shape({ |
|
|
.matches(/[a-zA-Z]/, "A senha só pode conter letras"), |
|
|
.matches(/[a-zA-Z]/, "A senha só pode conter letras"), |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function RegisterScreen(props) { |
|
|
export default function RegisterScreen(props) { |
|
|
const [singUpFailed, setSingUpFailed] = useState(false); |
|
|
const [singUpFailed, setSingUpFailed] = useState(false); |
|
|
|
|
|
|
|
|
const comparePassword = (password, confirmPassword) => { |
|
|
const comparePassword = (password, confirmPassword) => { |
|
|
if (password !== confirmPassword) { |
|
|
if (password !== confirmPassword) { |
|
|
setSingUpFailed(true); |
|
|
setSingUpFailed(true); |
|
|
console.log("Senhas Diferentes") |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
|
console.log("Senhas Diferentes"); |
|
|
|
|
|
} else { |
|
|
setSingUpFailed(false); |
|
|
setSingUpFailed(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<Screen style={styles.containter}> |
|
|
<Screen style={styles.containter}> |
|
@ -60,17 +57,24 @@ export default function RegisterScreen(props) { |
|
|
}} |
|
|
}} |
|
|
onSubmit={({ name, number, password, confirmPassword }) => { |
|
|
onSubmit={({ name, number, password, confirmPassword }) => { |
|
|
comparePassword(password, confirmPassword); |
|
|
comparePassword(password, confirmPassword); |
|
|
console.log("cadastro ainda não implementado") |
|
|
|
|
|
|
|
|
console.log("cadastro ainda não implementado"); |
|
|
}} |
|
|
}} |
|
|
validationSchema={validationSchema} |
|
|
validationSchema={validationSchema} |
|
|
> |
|
|
> |
|
|
<View style={{ flex: 1, flexDirection: "column", justifyContent: "center" }}> |
|
|
|
|
|
|
|
|
<View |
|
|
|
|
|
style={{ flex: 1, flexDirection: "column", justifyContent: "center" }} |
|
|
|
|
|
> |
|
|
<View style={{ flex: 1, justifyContent: "flex-end" }}> |
|
|
<View style={{ flex: 1, justifyContent: "flex-end" }}> |
|
|
<Text style={styles.title}>Pega Chuva</Text> |
|
|
|
|
|
|
|
|
<assets.AppLogoTitle |
|
|
|
|
|
preserveAspectRatio="xMidYMid meet" |
|
|
|
|
|
width={300} |
|
|
|
|
|
height={30} |
|
|
|
|
|
alignSelf="center" |
|
|
|
|
|
marginBottom={dimensions.spacing.big_padding} |
|
|
|
|
|
/> |
|
|
</View> |
|
|
</View> |
|
|
<View style={{ flex: 6 }}> |
|
|
<View style={{ flex: 6 }}> |
|
|
<KeyboardAwareScrollView |
|
|
|
|
|
scrollEnabled={true}> |
|
|
|
|
|
|
|
|
<KeyboardAwareScrollView scrollEnabled={true}> |
|
|
<View> |
|
|
<View> |
|
|
<Text style={styles.labelStyle}> Nome Completo: </Text> |
|
|
<Text style={styles.labelStyle}> Nome Completo: </Text> |
|
|
<FormField |
|
|
<FormField |
|
@ -107,9 +111,16 @@ export default function RegisterScreen(props) { |
|
|
placeholder="Nome Completo" |
|
|
placeholder="Nome Completo" |
|
|
/> |
|
|
/> |
|
|
</View> |
|
|
</View> |
|
|
<ErrorMessage error="As senhas não correspondem" visible={singUpFailed} /> |
|
|
|
|
|
|
|
|
<ErrorMessage |
|
|
|
|
|
error="As senhas não correspondem" |
|
|
|
|
|
visible={singUpFailed} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<SubmitButton title="cadastrar" backgroundColor={colors.primary} marginTop={10} /> |
|
|
|
|
|
|
|
|
<SubmitButton |
|
|
|
|
|
title="cadastrar" |
|
|
|
|
|
backgroundColor={colors.primary} |
|
|
|
|
|
marginTop={10} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
<TouchableNativeFeedback |
|
|
<TouchableNativeFeedback |
|
|
onPress={() => { |
|
|
onPress={() => { |
|
@ -136,11 +147,6 @@ const styles = StyleSheet.create({ |
|
|
textAlign: "center", |
|
|
textAlign: "center", |
|
|
padding: 10, |
|
|
padding: 10, |
|
|
}, |
|
|
}, |
|
|
title: { |
|
|
|
|
|
fontSize: dimensions.text.header, |
|
|
|
|
|
marginBottom: dimensions.spacing.big_padding, |
|
|
|
|
|
textAlign: "center", |
|
|
|
|
|
}, |
|
|
|
|
|
labelStyle: { |
|
|
labelStyle: { |
|
|
fontSize: dimensions.text.secondary, |
|
|
fontSize: dimensions.text.secondary, |
|
|
fontWeight: "bold", |
|
|
fontWeight: "bold", |
|
|