import PropTypes from 'prop-types'; import React from 'react'; import { domOnlyProps } from '../../../utils/reduxFormUtils'; import Button from '../../../common/Button'; class NewFileForm extends React.Component { constructor(props) { super(props); this.createFile = this.props.createFile.bind(this); } componentDidMount() { this.fileName.focus(); } render() { const { fields: { name }, handleSubmit } = this.props; return (
{ this.props.focusOnModal(); handleSubmit(this.createFile)(data); }} >
{ this.fileName = element; }} />
{name.touched && name.error && {name.error}}
); } } NewFileForm.propTypes = { fields: PropTypes.shape({ name: PropTypes.object.isRequired }).isRequired, handleSubmit: PropTypes.func.isRequired, createFile: PropTypes.func.isRequired, focusOnModal: PropTypes.func.isRequired }; export default NewFileForm;