|
|
@ -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){ |
|
|
|
if (password !== confirmPassword) { |
|
|
|
setSingUpFailed(true); |
|
|
|
console.log("Senhas Diferentes") |
|
|
|
} |
|
|
|
else{ |
|
|
|
console.log("Senhas Diferentes"); |
|
|
|
} else { |
|
|
|
setSingUpFailed(false); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
return ( |
|
|
|
<Screen style={styles.containter}> |
|
|
@ -58,19 +55,26 @@ export default function RegisterScreen(props) { |
|
|
|
password: "", |
|
|
|
confirmPassword: "", |
|
|
|
}} |
|
|
|
onSubmit={({name, number, password, confirmPassword}) => { |
|
|
|
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 |
|
|
@ -106,10 +110,17 @@ export default function RegisterScreen(props) { |
|
|
|
numberOfLines={1} |
|
|
|
placeholder="Nome Completo" |
|
|
|
/> |
|
|
|
</View> |
|
|
|
<ErrorMessage error="As senhas não correspondem" visible={singUpFailed} /> |
|
|
|
</View> |
|
|
|
<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={() => { |
|
|
@ -125,7 +136,7 @@ export default function RegisterScreen(props) { |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</Form> |
|
|
|
</Screen > |
|
|
|
</Screen> |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@ -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", |
|
|
|