diff --git a/src/app/molecules/media/Media.jsx b/src/app/molecules/media/Media.jsx index 919d7f96..c4b4a171 100644 --- a/src/app/molecules/media/Media.jsx +++ b/src/app/molecules/media/Media.jsx @@ -69,9 +69,8 @@ async function getUrl(link, type, decryptData) { } } -function getNativeHeight(width, height) { - const MEDIA_MAX_WIDTH = 296; - const scale = MEDIA_MAX_WIDTH / width; +function getNativeHeight(width, height, maxWidth = 296) { + const scale = maxWidth / width; return scale * height; } @@ -197,7 +196,7 @@ Image.propTypes = { }; function Sticker({ - name, link, file, type, + name, height, width, link, file, type, }) { const [url, setUrl] = useState(null); @@ -215,8 +214,8 @@ function Sticker({ }, []); return ( -
- { url !== null && {name}} +
+ { url !== null && {name}}
); } @@ -226,6 +225,10 @@ Sticker.defaultProps = { }; Sticker.propTypes = { name: PropTypes.string.isRequired, + width: null, + height: null, + width: PropTypes.number, + height: PropTypes.number, link: PropTypes.string.isRequired, file: PropTypes.shape({}), type: PropTypes.string, diff --git a/src/app/molecules/message/Message.jsx b/src/app/molecules/message/Message.jsx index 5195a3d1..cb051052 100644 --- a/src/app/molecules/message/Message.jsx +++ b/src/app/molecules/message/Message.jsx @@ -635,6 +635,8 @@ function genMediaContent(mE) { return (