Created
July 21, 2019 15:15
-
-
Save ralfting/e6f4f1258b3a5fe23647711abc765262 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 { 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