Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. {width:{width1: "somevalue", width2: "someValue", width3: "someValue"}}
  2.  
  3. {thickness:{thickness1: "somevalue", thickness2: "someValue", thickness3: "someValue"}}
  4.  
  5. import React from 'react'
  6. import { View, Text } from 'react-native'
  7. import { connect } from 'react-redux'
  8. import { formStyles } from '../../style'
  9. import { DimenInput } from '../dimenInput/DimenInput'
  10. import { updateDimension } from '../../actions/updateDimension.action'
  11.  
  12. const mapStateToProps = (state) => {
  13. return {
  14. width1: state.get('width').get('width1').toString(),
  15. width2: state.get('width').get('width2').toString(),
  16. width3: state.get('width').get('width3').toString()
  17. }
  18. }
  19.  
  20. const mapDispatchToProps = (dispatch) => {
  21. return {
  22. updateWidth: (text, number) => {
  23. dispatch(updateDimension('width', text, number))
  24. }
  25. }
  26. }
  27.  
  28. let Width = (props) => {
  29. return (
  30. <View style={formStyles.container}>
  31. <DimenInput
  32. value={props.width1}
  33. onChangeText={text => props.updateWidth(text, 1)}
  34. />
  35. <Text style={formStyles.text}>{'&'}</Text>
  36. <DimenInput
  37. value={props.width2}
  38. onChangeText={text => props.updateWidth(text, 2)}
  39. />
  40. <Text style={formStyles.text}>{'/'}</Text>
  41. <DimenInput
  42. value={props.width3}
  43. onChangeText={text => props.updateWidth(text, 3)}
  44. />
  45. </View>
  46. )
  47. }
  48. Width.propTypes = {
  49. width1: React.PropTypes.string.isRequired,
  50. width2: React.PropTypes.string.isRequired,
  51. width3: React.PropTypes.string.isRequired,
  52. updateWidth: React.PropTypes.func.isRequired
  53. }
  54.  
  55. Width = connect(
  56. mapStateToProps,
  57. mapDispatchToProps
  58. )(Width)
  59.  
  60. export default Width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement