Created
March 5, 2020 18:02
-
-
Save bogoslavskiy/a4bbb03860e4b7a107e54d6154a5f49b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { View } from 'react-native'; | |
import { AuthNavProps } from '../navigation/types/AuthStackParams'; | |
import { Input } from '../components/Input'; | |
import { Button } from '../components/Button'; | |
import { AuthContext } from '../contexts/AuthContext'; | |
export const LoginScreen = ({}: AuthNavProps<'Login'>) => { | |
const [name, setName] = React.useState(''); | |
const { login } = React.useContext(AuthContext); | |
return ( | |
<View style={{ flex: 1, marginTop: 12 }}> | |
<Input | |
autoFocus | |
placeholder="Your name" | |
onChangeText={(text) => setName(text)} | |
value={name} | |
/> | |
<View style={{ alignItems: 'center' }}> | |
<Button | |
title="Next" | |
onPress={() => !!name && login(name)} | |
/> | |
</View> | |
</View> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment