-
-
Save Mike1stver/6a102f425ad2b9522526dea2ad19f5f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
const handleChange = (handler) => ({target: {files}}) => | |
handler(files.length ? {file: files[0], name: files[0].name} : {}); | |
export default ({ | |
input: {onChange, onBlur, value: omitValue, ...inputProps}, | |
meta: omitMeta, | |
...props | |
}) => ( | |
<input type="file" | |
onChange={handleChange(onChange)} onBlur={handleChange(onBlur)} | |
{...inputProps} {...props} /> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment