File tree Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Expand file tree Collapse file tree 3 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -1358,7 +1358,7 @@ function (_Component) {
1358
1358
key : "componentWillUnmount" ,
1359
1359
value : function componentWillUnmount ( ) {
1360
1360
this . unmounted = true ;
1361
- } // Load the image to measure its dimensions
1361
+ } // Load the background image in memory to measure its dimensions
1362
1362
1363
1363
} , {
1364
1364
key : "getImageDimensionInfo" ,
@@ -1397,10 +1397,10 @@ function (_Component) {
1397
1397
var _this$state = this . state ,
1398
1398
naturalHeight = _this$state . naturalHeight ,
1399
1399
naturalWidth = _this$state . naturalWidth ;
1400
- return React__default . createElement ( "img " , _extends ( {
1401
- src : src ,
1402
- width : naturalWidth || undefined ,
1403
- height : naturalHeight || undefined
1400
+ return React__default . createElement ( "image " , _extends ( {
1401
+ href : src ,
1402
+ width : naturalWidth ,
1403
+ height : naturalHeight
1404
1404
} , otherProps ) ) ;
1405
1405
}
1406
1406
} ] ) ;
Original file line number Diff line number Diff line change @@ -1351,7 +1351,7 @@ function (_Component) {
1351
1351
key : "componentWillUnmount" ,
1352
1352
value : function componentWillUnmount ( ) {
1353
1353
this . unmounted = true ;
1354
- } // Load the image to measure its dimensions
1354
+ } // Load the background image in memory to measure its dimensions
1355
1355
1356
1356
} , {
1357
1357
key : "getImageDimensionInfo" ,
@@ -1390,10 +1390,10 @@ function (_Component) {
1390
1390
var _this$state = this . state ,
1391
1391
naturalHeight = _this$state . naturalHeight ,
1392
1392
naturalWidth = _this$state . naturalWidth ;
1393
- return React . createElement ( "img " , _extends ( {
1394
- src : src ,
1395
- width : naturalWidth || undefined ,
1396
- height : naturalHeight || undefined
1393
+ return React . createElement ( "image " , _extends ( {
1394
+ href : src ,
1395
+ width : naturalWidth ,
1396
+ height : naturalHeight
1397
1397
} , otherProps ) ) ;
1398
1398
}
1399
1399
} ] ) ;
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class ImageLayer extends Component {
27
27
this . unmounted = true ;
28
28
}
29
29
30
- // Load the image to measure its dimensions
30
+ // Load the background image in memory to measure its dimensions
31
31
getImageDimensionInfo ( ) {
32
32
const { src : initialSrc } = this . props ;
33
33
const memoryImage = new Image ( ) ;
@@ -41,7 +41,6 @@ class ImageLayer extends Component {
41
41
naturalWidth : memoryImage . naturalWidth ,
42
42
naturalHeight : memoryImage . naturalHeight ,
43
43
} ) ;
44
-
45
44
this . props . onLoad ( {
46
45
naturalWidth : memoryImage . naturalWidth ,
47
46
naturalHeight : memoryImage . naturalHeight ,
@@ -55,11 +54,10 @@ class ImageLayer extends Component {
55
54
const { naturalHeight, naturalWidth } = this . state ;
56
55
57
56
return (
58
- < img
59
- src = { src }
60
- alt = ""
61
- width = { naturalWidth || undefined }
62
- height = { naturalHeight || undefined }
57
+ < image
58
+ href = { src }
59
+ width = { naturalWidth }
60
+ height = { naturalHeight }
63
61
{ ...otherProps }
64
62
/>
65
63
) ;
@@ -75,4 +73,4 @@ ImageLayer.defaultProps = {
75
73
onLoad : ( ) => { } ,
76
74
} ;
77
75
78
- export default ImageLayer ;
76
+ export default ImageLayer ;
You can’t perform that action at this time.
0 commit comments