@s-ui/react-atom-image
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.8.0"></a> | ||
# 1.8.0 (2018-12-12) | ||
### Features | ||
* add ref to img to ensure image complete loaded in SSR ([76702a8](https://github.com/SUI-Components/sui-components/commit/76702a8)) | ||
<a name="1.7.0"></a> | ||
@@ -7,0 +17,0 @@ # 1.7.0 (2018-10-03) |
@@ -93,3 +93,3 @@ 'use strict'; | ||
error: false | ||
}, _this.handleLoad = function () { | ||
}, _this.imageRef = _react2.default.createRef(), _this.handleLoad = function () { | ||
var onLoad = _this.props.onLoad; | ||
@@ -111,2 +111,10 @@ | ||
(0, _createClass3.default)(AtomImage, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
var img = this.imageRef.current; | ||
if (img && img.complete && this.state.loading) { | ||
this.handleLoad(); | ||
} | ||
} | ||
}, { | ||
key: 'render', | ||
@@ -145,3 +153,4 @@ value: function render() { | ||
onLoad: this.handleLoad, | ||
onError: this.handleError | ||
onError: this.handleError, | ||
ref: this.imageRef | ||
}, imgProps)) | ||
@@ -148,0 +157,0 @@ ), |
{ | ||
"name": "@s-ui/react-atom-image", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
13407
183