Skip to content

Instantly share code, notes, and snippets.

@gHashTag
Created March 23, 2017 23:29
Show Gist options
  • Save gHashTag/65049b38f9b5e60c7a0448efeee54b8a to your computer and use it in GitHub Desktop.
Save gHashTag/65049b38f9b5e60c7a0448efeee54b8a to your computer and use it in GitHub Desktop.
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@gmail.com"
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