50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
import { StatusBar } from 'expo-status-bar';
|
|
import React, { useState } from 'react';
|
|
import { Text, View, TextInput, Button } from 'react-native';
|
|
import API from './../API.js';
|
|
|
|
|
|
let LoginForm = ()=>{
|
|
let [email, setEmail] = useState('');
|
|
let [password, setPassword] = useState('');
|
|
|
|
return (
|
|
<View>
|
|
<Text>Log in</Text>
|
|
<TextInput
|
|
style={{
|
|
height: 40,
|
|
width: 200,
|
|
borderColor: 'gray',
|
|
borderWidth: 1
|
|
}}
|
|
onChangeText={text => setEmail(text)}
|
|
defaultValue={email}
|
|
placeholder=" email"
|
|
/>
|
|
<TextInput
|
|
style={{
|
|
height: 40,
|
|
width: 200,
|
|
borderColor: 'gray',
|
|
borderWidth: 1
|
|
}}
|
|
onChangeText={text => setPassword(text)}
|
|
defaultValue={password}
|
|
placeholder=" password"
|
|
textContentType="password"
|
|
secureTextEntry={true}
|
|
/>
|
|
<Button
|
|
onPress={async () => {
|
|
let r = await API.logIn(email, password);
|
|
console.log(r);
|
|
}}
|
|
title={"login"}
|
|
/>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export default LoginForm;
|