-import React from 'react';
-import PropTypes from 'prop-types';
import classNames from 'classnames';
+import PropTypes from 'prop-types';
+import React, { PureComponent } from 'react';
import { LoadingBar } from 'react-redux-loading-bar';
import ZoomableImage from './zoomable_image';
-export default class ImageLoader extends React.PureComponent {
+export default class ImageLoader extends PureComponent {
static propTypes = {
alt: PropTypes.string,
this.loadImage(this.props);
}
- componentWillReceiveProps (nextProps) {
+ UNSAFE_componentWillReceiveProps (nextProps) {
if (this.props.src !== nextProps.src) {
this.loadImage(nextProps);
}
return (
<div className={className}>
- <LoadingBar loading={loading ? 1 : 0} className='loading-bar' style={{ width: this.state.width || width }} />
{loading ? (
- <canvas
- className='image-loader__preview-canvas'
- ref={this.setCanvasRef}
- width={width}
- height={height}
- />
+ <>
+ <div className='loading-bar__container' style={{ width: this.state.width || width }}>
+ <LoadingBar className='loading-bar' loading={1} />
+ </div>
+ <canvas
+ className='image-loader__preview-canvas'
+ ref={this.setCanvasRef}
+ width={width}
+ height={height}
+ />
+ </>
) : (
<ZoomableImage
alt={alt}
object-fit: contain;
}
- .loading-bar {
+ .loading-bar__container {
position: relative;
}
+ .loading-bar {
+ position: absolute;
+ }
+
&.image-loader--amorphous .image-loader__preview-canvas {
display: none;
}
"react-notification": "^6.8.5",
"react-overlays": "^0.9.3",
"react-redux": "^7.2.8",
- "react-redux-loading-bar": "^4.0.8",
+ "react-redux-loading-bar": "^5.0.4",
"react-router-dom": "^4.1.1",
"react-router-scroll-4": "^1.0.0-beta.1",
"react-select": "^5.4.0",
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.1.0.tgz#61aaed3096d30eacf2a2127118b5b41387d32a67"
integrity sha512-Fl7FuabXsJnV5Q1qIOQwx/sagGF18kogb4gpfcG4gjLBWO0WDiiz1ko/ExayuxE7InyQkBLkxRFG5oxY6Uu3Kg==
-react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4:
+react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
react-transition-group "^2.2.1"
warning "^3.0.0"
-react-redux-loading-bar@^4.0.8:
- version "4.0.8"
- resolved "https://registry.yarnpkg.com/react-redux-loading-bar/-/react-redux-loading-bar-4.0.8.tgz#e84d59d1517b79f53b0f39c8ddb40682af648c1b"
- integrity sha512-BpR1tlYrYKFtGhxa7nAKc0dpcV33ZgXJ/jKNLpDDaxu2/cCxbkWQt9YlWT+VLw1x/7qyNYY4DH48bZdtmciSpg==
+react-redux-loading-bar@^5.0.4:
+ version "5.0.4"
+ resolved "https://registry.yarnpkg.com/react-redux-loading-bar/-/react-redux-loading-bar-5.0.4.tgz#06dffcc53a447828dec1a26903e6b22807dd4254"
+ integrity sha512-ttLFYETh9zfyxJdTa5a1+KTWquxX3UN7F/XYslNTeCE8cpnWNpBbUOg8TcaZmOoWEWjCe/i5sV/Mvvr0xsGBBw==
dependencies:
- prop-types "^15.6.2"
- react-lifecycles-compat "^3.0.2"
+ prop-types "^15.7.2"
+ react-lifecycles-compat "^3.0.4"
react-redux@^7.2.8:
version "7.2.8"