Fix brand image not showing up after selecting it and before uploading (#3197)

Этот коммит содержится в:
Joram Wilander
2016-06-01 16:16:24 -04:00
родитель 81535c0efb
Коммит 75107dc15d

Просмотреть файл

@@ -40,6 +40,19 @@ export default class BrandImageSetting extends React.Component {
});
}
componentDidUpdate() {
if (this.refs.image) {
const reader = new FileReader();
const img = this.refs.image;
reader.onload = (e) => {
$(img).attr('src', e.target.result);
};
reader.readAsDataURL(this.state.brandImage);
}
}
handleImageChange() {
const element = $(this.refs.fileInput);
@@ -151,6 +164,7 @@ export default class BrandImageSetting extends React.Component {
ref='fileInput'
type='file'
accept='.jpg,.png,.bmp'
disabled={this.props.disabled}
onChange={this.handleImageChange}
/>
</div>