Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { connect } from 'react-redux'
  3. import { emailChanged, passwordChanged } from '../actions'
  4. import { Card, CardSection, Input, Button } from './common'
  5.  
  6. class LoginForm extends Component {
  7. onEmailChange(text) {
  8. this.props.emailChanged(text)
  9. }
  10.  
  11. onPasswordChange(text) {
  12. this.props.passwordChanged(text)
  13. }
  14.  
  15. render() {
  16. return (
  17. <Card>
  18. <CardSection>
  19. <Input
  20. label="Email"
  21. placeholder="email@gmail.com"
  22. onChangeText={this.onEmailChange.bind(this)}
  23. value={this.props.email}
  24. />
  25. </CardSection>
  26.  
  27. <CardSection>
  28. <Input
  29. secureTextEntry
  30. label="Password"
  31. placeholder="password"
  32. onChangeText={this.onPasswordChange.bind(this)}
  33. value={this.props.password}
  34. />
  35. </CardSection>
  36.  
  37. <CardSection>
  38. <Button>
  39. Login
  40. </Button>
  41. </CardSection>
  42.  
  43. </Card>
  44. )
  45. }
  46. }
  47.  
  48. const mapStateToProps = state => {
  49. return {
  50. email: state.auth.email,
  51. password: state.auth.password
  52. }
  53.  
  54. export default connect( mapStateToProps, { emailChanged, passwordChanged })(LoginForm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement