// @flow import * as React from 'react'; import {Keyboard, KeyboardAvoidingView, StyleSheet, TouchableWithoutFeedback, View} from "react-native"; import {Button, Text, TextInput, Title} from 'react-native-paper'; import ConnectionManager from "../../managers/ConnectionManager"; type Props = { navigation: Object, } type State = { email: string, password: string, } export default class LoginScreen extends React.Component { state = { email: '', password: '', }; onEmailChange: Function; onPasswordChange: Function; constructor() { super(); this.onEmailChange = this.onInputChange.bind(this, true); this.onPasswordChange = this.onInputChange.bind(this, false); } onInputChange(isEmail: boolean, value: string) { if (isEmail) this.setState({email: value}); else this.setState({password: value}); } onSubmit() { console.log('pressed'); ConnectionManager.getInstance().connect(this.state.email, this.state.password) .then((data) => { console.log(data); }) .catch((error) => { console.log(error); }); } render() { return ( COUCOU entrez vos identifiants Pas de compte, dommage ! ); } } const styles = StyleSheet.create({ container: { flex: 1 }, inner: { padding: 24, flex: 1, }, header: { fontSize: 36, marginBottom: 48 }, textInput: {}, btnContainer: { marginTop: 12 } });