Skip to content

Instantly share code, notes, and snippets.

@ralfting
Created July 21, 2019 15:15
Show Gist options
  • Select an option

  • Save ralfting/e6f4f1258b3a5fe23647711abc765262 to your computer and use it in GitHub Desktop.

Select an option

Save ralfting/e6f4f1258b3a5fe23647711abc765262 to your computer and use it in GitHub Desktop.
import React from 'react';
import { TextInput, Button } from 'react-native-paper';
import { Text, View } from 'react-native';
class LoginPage extends React.Component {
state = {
login: '',
password: '',
}
updateCredentials = (newCredentials) => {
const crededntialUpdated = {
...this.state.credentials,
...newCredentials,
};
this.setState(crededntialUpdated);
}
onSubmit = () => {
login(this.state);
}
render() {
return (
<View>
<Text>Login page</Text>
<TextInput
label='E-mail'
value={this.state.login}
onChangeText={login => this.updateCredentials({ login })}
/>
<TextInput
label='Senha'
password={this.state.password}
onChangeText={password => this.updateCredentials({ password })}
/>
<Button onPress={this.onSubmit}>Logar</Button>
</View>
);
}
}
export default LoginPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment