Skip to content

Instantly share code, notes, and snippets.

@bogoslavskiy
Created March 5, 2020 18:02
Show Gist options
  • Save bogoslavskiy/a4bbb03860e4b7a107e54d6154a5f49b to your computer and use it in GitHub Desktop.
Save bogoslavskiy/a4bbb03860e4b7a107e54d6154a5f49b to your computer and use it in GitHub Desktop.
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