static-cms/src/components/Widgets/ImagePreview.js
Cássio Zen 0f1b95f262 typos
2016-06-05 23:37:19 -03:00

19 lines
465 B
JavaScript

import React from 'react';
export default class ImagePreview extends React.Component {
constructor(props) {
super(props);
this.handleImageLoaded = this.handleImageLoaded.bind(this);
}
handleImageLoaded() {
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;
}
}