Support blurhashes on stickers

pull/21833/head
Michael Telatynski 2021-05-24 10:06:17 +01:00
parent 3f9b6caacd
commit 44e14a7d43
1 changed files with 3 additions and 1 deletions

View File

@ -18,6 +18,7 @@ import React from 'react';
import MImageBody from './MImageBody'; import MImageBody from './MImageBody';
import * as sdk from '../../../index'; import * as sdk from '../../../index';
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
import {BLURHASH_FIELD} from "../../../ContentMessages";
@replaceableComponent("views.messages.MStickerBody") @replaceableComponent("views.messages.MStickerBody")
export default class MStickerBody extends MImageBody { export default class MStickerBody extends MImageBody {
@ -41,7 +42,8 @@ export default class MStickerBody extends MImageBody {
// Placeholder to show in place of the sticker image if // Placeholder to show in place of the sticker image if
// img onLoad hasn't fired yet. // img onLoad hasn't fired yet.
getPlaceholder() { getPlaceholder(width, height) {
if (this.props.mxEvent.getContent().info[BLURHASH_FIELD]) return super.getPlaceholder(width, height);
const TintableSVG = sdk.getComponent('elements.TintableSvg'); const TintableSVG = sdk.getComponent('elements.TintableSvg');
return <TintableSVG src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />; return <TintableSVG src={require("../../../../res/img/icons-show-stickers.svg")} width="75" height="75" />;
} }