|
|
@ -10,9 +10,9 @@ import Screen from "../components/Screen"; |
|
|
|
import { dimensions } from "../config/dimensions"; |
|
|
|
import colors from "../config/colors"; |
|
|
|
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view"; |
|
|
|
import assets from "../config/assets"; |
|
|
|
import * as Yup from "yup"; |
|
|
|
|
|
|
|
|
|
|
|
const phoneRegex = RegExp( |
|
|
|
/^\(?[\(]?([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"), |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function RegisterScreen(props) { |
|
|
|
const [singUpFailed, setSingUpFailed] = useState(false); |
|
|
|
|
|
|
|
const comparePassword = (password, confirmPassword) => { |
|
|
|
if (password !== confirmPassword) { |
|
|
|
setSingUpFailed(true); |
|
|
|
console.log("Senhas Diferentes") |
|
|
|
} |
|
|
|
else{ |
|
|
|
console.log("Senhas Diferentes"); |
|
|
|
} else { |
|
|
|
setSingUpFailed(false); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Screen style={styles.containter}> |
|
|
@ -60,17 +57,24 @@ export default function RegisterScreen(props) { |
|
|
|
}} |
|
|
|
onSubmit={({ name, number, password, confirmPassword }) => { |
|
|
|
comparePassword(password, confirmPassword); |
|
|
|
console.log("cadastro ainda não implementado") |
|
|
|
console.log("cadastro ainda não implementado"); |
|
|
|
}} |
|
|
|
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" }}> |
|
|
|
<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 style={{ flex: 6 }}> |
|
|
|
<KeyboardAwareScrollView |
|
|
|
scrollEnabled={true}> |
|
|
|
<KeyboardAwareScrollView scrollEnabled={true}> |
|
|
|
<View> |
|
|
|
<Text style={styles.labelStyle}> Nome Completo: </Text> |
|
|
|
<FormField |
|
|
@ -107,9 +111,16 @@ export default function RegisterScreen(props) { |
|
|
|
placeholder="Nome Completo" |
|
|
|
/> |
|
|
|
</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 |
|
|
|
onPress={() => { |
|
|
@ -136,11 +147,6 @@ const styles = StyleSheet.create({ |
|
|
|
textAlign: "center", |
|
|
|
padding: 10, |
|
|
|
}, |
|
|
|
title: { |
|
|
|
fontSize: dimensions.text.header, |
|
|
|
marginBottom: dimensions.spacing.big_padding, |
|
|
|
textAlign: "center", |
|
|
|
}, |
|
|
|
labelStyle: { |
|
|
|
fontSize: dimensions.text.secondary, |
|
|
|
fontWeight: "bold", |
|
|
|