diff --git a/app/(pages)/_layout.tsx b/app/(pages)/_layout.tsx index e9b8d62..3d97db3 100644 --- a/app/(pages)/_layout.tsx +++ b/app/(pages)/_layout.tsx @@ -30,6 +30,24 @@ const TabLayout: React.FC = () => { }, }} /> + { + return + }, + }} + /> + { + return + }, + }} + /> ) } diff --git a/app/(pages)/login.tsx b/app/(pages)/login.tsx new file mode 100644 index 0000000..c5916c0 --- /dev/null +++ b/app/(pages)/login.tsx @@ -0,0 +1,95 @@ +import { StyleSheet, Image } from "react-native" +import { + Button, + TextInput, + HelperText, + ActivityIndicator, + Banner, +} from "react-native-paper" +import { SafeAreaView } from "react-native-safe-area-context" +import * as React from "react" + +const LoginPage: React.FC = () => { + // Gérer l'état de votre formulaire ici : timeout, invalidité, etc. + // Possible de changer le type comme string. + const [hasError, _sethasError] = React.useState(true) + + // Message d'erreur à afficher pour HelperText + const [errorMessage, _setErrorMessage] = + React.useState("Error message") + + // Affichage de l'indicateur de chargement + const [isPerfomingLogin, _setIsPerfomingLogin] = React.useState(true) + + return ( + + { + return console.log("Pressed") + }, + }, + ]} + icon={({ size }) => { + return ( + + ) + }} + > + There was an error while trying to login. + + + + + {errorMessage} + + + + + ) +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + alignItems: "center", + justifyContent: "center", + }, + input: { + width: "80%", + marginBottom: 10, + }, + errorText: { + marginBottom: 10, + }, + indicator: { + marginTop: 10, + marginBottom: 10, + }, +}) + +export default LoginPage diff --git a/app/(pages)/register.tsx b/app/(pages)/register.tsx new file mode 100644 index 0000000..b9d7143 --- /dev/null +++ b/app/(pages)/register.tsx @@ -0,0 +1,109 @@ +import { StyleSheet, Image } from "react-native" +import { + Button, + TextInput, + HelperText, + ActivityIndicator as _ActivityIndicator, + Banner, +} from "react-native-paper" +import { SafeAreaView } from "react-native-safe-area-context" +import * as React from "react" + +const RegisterPage: React.FC = () => { + const regexEmail = /^[\w.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,4}$/ + + const [password, setPassword] = React.useState("") + const [isPasswordCorrect, setIsPasswordCorrect] = + React.useState(true) + const [isEmailValid, setIsEmailValid] = React.useState(true) + + return ( + + { + return console.log("Pressed") + }, + }, + ]} + icon={({ size }) => { + return ( + + ) + }} + > + There was an error while trying to register. + + + { + setIsEmailValid(regexEmail.test(text)) + }} + /> + {isEmailValid ? null : ( + + Email address is invalid! + + )} + { + setPassword(text) + console.log(text) + }} + /> + { + setIsPasswordCorrect(text === password) + }} + /> + + Error message + + + + ) +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + alignItems: "center", + justifyContent: "center", + }, + input: { + width: "80%", + margin: 10, + }, + errorText: { + margin: 10, + }, +}) + +export default RegisterPage