From: ThibG Date: Sat, 14 Jul 2018 23:18:09 +0000 (+0200) Subject: Use LoadingBar instead of blur to indicate that an image is loading (fixes #4060... X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=955d5d36e80259d8c10a0246d359f35f63de059d;p=mastodon.git Use LoadingBar instead of blur to indicate that an image is loading (fixes #4060) (#7562) --- diff --git a/app/javascript/mastodon/features/ui/components/image_loader.js b/app/javascript/mastodon/features/ui/components/image_loader.js index c7360a726..5e1cf75af 100644 --- a/app/javascript/mastodon/features/ui/components/image_loader.js +++ b/app/javascript/mastodon/features/ui/components/image_loader.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; +import { LoadingBar } from 'react-redux-loading-bar'; import ZoomableImage from './zoomable_image'; export default class ImageLoader extends React.PureComponent { @@ -23,6 +24,7 @@ export default class ImageLoader extends React.PureComponent { state = { loading: true, error: false, + width: null, } removers = []; @@ -122,6 +124,7 @@ export default class ImageLoader extends React.PureComponent { setCanvasRef = c => { this.canvas = c; + if (c) this.setState({ width: c.offsetWidth }); } render () { @@ -135,6 +138,7 @@ export default class ImageLoader extends React.PureComponent { return (
+ {loading ? (