text: import React, { Component } from 'react'
  import { connect } from 'react-redux'
  import { injectIntl, intlShape } from 'react-intl'
  import { Field, reduxForm, formValueSelector } from 'redux-form'
  import { TextField } from 'redux-form-material-ui'
  import { setDialogIsOpen } from 'rmw-shell/lib/store/dialogs/actions'
  import { withRouter } from 'react-router-dom'
  import { withTheme } from '@material-ui/core/styles'
  import PropTypes from 'prop-types'
  
  class Form extends Component {
    render() {
      const {
        handleSubmit,
        intl,
        initialized
      } = this.props
  
      return (
        <form onSubmit={handleSubmit} style={{
          height: '100%',
          alignItems: 'strech',
          display: 'flex',
          flexWrap: 'wrap',
          justifyContent: 'center'
        }}>
          <button type='submit' style={{ display: 'none' }} />
  
          <div>
            <div>
              <Field
                name='title'
                disabled={!initialized}
                component={TextField}
                placeholder={intl.formatMessage({ id: 'title_hint' })}
                label={intl.formatMessage({ id: 'title_label' })}
                ref='title'
                withRef
              />
            </div>
  
            <div>
              <Field
                name='description'
                disabled={!initialized}
                component={TextField}
                multiline
                placeholder={intl.formatMessage({ id: 'description_hint' })}
                label={intl.formatMessage({ id: 'description_label' })}
                ref='description'
                withRef
              />
            </div>
          </div>
  
        </form>
      )
    }
  }
  
  Form.propTypes = {
    handleSubmit: PropTypes.func.isRequired,
    intl: intlShape.isRequired,
    initialized: PropTypes.bool.isRequired,
    setDialogIsOpen: PropTypes.func.isRequired,
    dialogs: PropTypes.object.isRequired,
    match: PropTypes.object.isRequired
  }
  
  Form = reduxForm({ form: 'task' })(Form)
  const selector = formValueSelector('task')
  
  const mapStateToProps = state => {
    const { intl, vehicleTypes, users, dialogs } = state
  
    return {
      intl,
      vehicleTypes,
      users,
      dialogs,
      photoURL: selector(state, 'photoURL')
    }
  }
  
  export default connect(
    mapStateToProps, { setDialogIsOpen }
  )(injectIntl(withRouter(withTheme()(Form))))
  