This commit is contained in:
Cássio Zen 2016-06-05 23:37:19 -03:00
parent ade51b27fc
commit 0f1b95f262
2 changed files with 3 additions and 2 deletions

View File

@ -35,7 +35,7 @@ export default class ImageControl extends React.Component {
const files = [...fileList];
const imageType = /^image\//;
// Iterate to list of files and return the first image on the list
// Iterate through the list of files and return the first image on the list
const file = files.find((currentFile) => {
if (imageType.test(currentFile.type)) {
return currentFile;

View File

@ -7,10 +7,11 @@ export default class ImagePreview extends React.Component {
}
handleImageLoaded() {
window.URL.revokeObjectURL(this.props);
window.URL.revokeObjectURL(this.props.value);
}
render() {
console.log(this.props)
const { value } = this.props;
return value ? <img src={window.URL.createObjectURL(value)} onLoad={this.handleImageLoaded} /> : null;
}