Created
March 23, 2017 23:29
-
-
Save gHashTag/7d51b829386303d706818e622d875eec 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, { Component } from 'react' | |
import { connect } from 'react-redux' | |
import { emailChanged, passwordChanged } from '../actions' | |
import { Card, CardSection, Input, Button } from './common' | |
class LoginForm extends Component { | |
onEmailChange(text) { | |
this.props.emailChanged(text) | |
} | |
onPasswordChange(text) { | |
this.props.passwordChanged(text) | |
} | |
render() { | |
return ( | |
<Card> | |
<CardSection> | |
<Input | |
label="Email" | |
placeholder="[email protected]" | |
onChangeText={this.onEmailChange.bind(this)} | |
value={this.props.email} | |
/> | |
</CardSection> | |
<CardSection> | |
<Input | |
secureTextEntry | |
label="Password" | |
placeholder="password" | |
onChangeText={this.onPasswordChange.bind(this)} | |
value={this.props.password} | |
/> | |
</CardSection> | |
<CardSection> | |
<Button> | |
Login | |
</Button> | |
</CardSection> | |
</Card> | |
) | |
} | |
} | |
const mapStateToProps = state => { | |
return { | |
email: state.auth.email, | |
password: state.auth.password | |
} | |
export default connect( mapStateToProps, { emailChanged, passwordChanged })(LoginForm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment