import React, { useContext, useState } from 'react' import { Text, View, TextInput, Button, StyleSheet } from 'react-native' import signUp from '../components/SignUp' import { UsernameContext, TokenContext } from '../Context/Context' export default function SignUpScreen({ navigation }) { const [ username, setUsername] = useContext(UsernameContext) const [ token, setToken] = useContext(TokenContext) const [ password, setPassword] = useState("") const [error, setError] = useState("") const signup = () => { signUp(username, password) .then(token => { setToken(token) setUsername(username) }).catch(err => setError(err)) } return ( {error} Token is {token === undefined ? "undefined" : (token === null ? "null" : token)} username is {username} Nom d'utilisateur: Mot de passe: