From a5e1eaa05e612f4892a7443a6b58157ed374f38e Mon Sep 17 00:00:00 2001 From: Prashant Mangukiya Date: Fri, 10 Sep 2021 00:21:12 +0530 Subject: [PATCH] Corrected blurry image preview within chat list when extra long image used. --- src/components/ThumbnailImage.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/ThumbnailImage.js b/src/components/ThumbnailImage.js index e1bebb06656a..95cf9a1ab52a 100644 --- a/src/components/ThumbnailImage.js +++ b/src/components/ThumbnailImage.js @@ -1,3 +1,4 @@ +import lodashClamp from 'lodash/clamp'; import React, {PureComponent} from 'react'; import {View} from 'react-native'; import PropTypes from 'prop-types'; @@ -36,7 +37,8 @@ class ThumbnailImage extends PureComponent { updateImageSize({width, height}) { // Width of the thumbnail works better as a constant than it does // a percentage of the screen width since it is relative to each screen - const thumbnailScreenWidth = 250; + // Note: Clamp minimum width 40px to support touch device + const thumbnailScreenWidth = lodashClamp(width, 40, 250); const scaleFactor = width / thumbnailScreenWidth; const imageHeight = height / scaleFactor; this.setState({thumbnailWidth: thumbnailScreenWidth, thumbnailHeight: imageHeight});