Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {width:{width1: "somevalue", width2: "someValue", width3: "someValue"}}
- {thickness:{thickness1: "somevalue", thickness2: "someValue", thickness3: "someValue"}}
- import React from 'react'
- import { View, Text } from 'react-native'
- import { connect } from 'react-redux'
- import { formStyles } from '../../style'
- import { DimenInput } from '../dimenInput/DimenInput'
- import { updateDimension } from '../../actions/updateDimension.action'
- const mapStateToProps = (state) => {
- return {
- width1: state.get('width').get('width1').toString(),
- width2: state.get('width').get('width2').toString(),
- width3: state.get('width').get('width3').toString()
- }
- }
- const mapDispatchToProps = (dispatch) => {
- return {
- updateWidth: (text, number) => {
- dispatch(updateDimension('width', text, number))
- }
- }
- }
- let Width = (props) => {
- return (
- <View style={formStyles.container}>
- <DimenInput
- value={props.width1}
- onChangeText={text => props.updateWidth(text, 1)}
- />
- <Text style={formStyles.text}>{'&'}</Text>
- <DimenInput
- value={props.width2}
- onChangeText={text => props.updateWidth(text, 2)}
- />
- <Text style={formStyles.text}>{'/'}</Text>
- <DimenInput
- value={props.width3}
- onChangeText={text => props.updateWidth(text, 3)}
- />
- </View>
- )
- }
- Width.propTypes = {
- width1: React.PropTypes.string.isRequired,
- width2: React.PropTypes.string.isRequired,
- width3: React.PropTypes.string.isRequired,
- updateWidth: React.PropTypes.func.isRequired
- }
- Width = connect(
- mapStateToProps,
- mapDispatchToProps
- )(Width)
- export default Width
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement