Remove awaiting setState()
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
ccc042b7d7
commit
f5d8bb7cbe
1 changed files with 3 additions and 3 deletions
|
@ -140,12 +140,12 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
this.image.current.removeEventListener("load", this.imageLoaded);
|
this.image.current.removeEventListener("load", this.imageLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private imageLoaded = async () => {
|
private imageLoaded = () => {
|
||||||
// First, we calculate the zoom, so that the image has the same size as
|
// First, we calculate the zoom, so that the image has the same size as
|
||||||
// the thumbnail
|
// the thumbnail
|
||||||
const { thumbnailInfo } = this.props;
|
const { thumbnailInfo } = this.props;
|
||||||
if (thumbnailInfo?.width) {
|
if (thumbnailInfo?.width) {
|
||||||
await this.setState({ zoom: thumbnailInfo.width / this.image.current.naturalWidth });
|
this.setState({ zoom: thumbnailInfo.width / this.image.current.naturalWidth });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once the zoom is set, we the image is considered loaded and we can
|
// Once the zoom is set, we the image is considered loaded and we can
|
||||||
|
@ -153,7 +153,7 @@ export default class ImageView extends React.Component<IProps, IState> {
|
||||||
this.imageIsLoaded = true;
|
this.imageIsLoaded = true;
|
||||||
this.animatingLoading = true;
|
this.animatingLoading = true;
|
||||||
this.setZoomAndRotation();
|
this.setZoomAndRotation();
|
||||||
await this.setState({
|
this.setState({
|
||||||
translationX: 0,
|
translationX: 0,
|
||||||
translationY: 0,
|
translationY: 0,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue