From 14dc37671f41d5754e2d48fe9eef7ee4871ad84e Mon Sep 17 00:00:00 2001 From: feruz Date: Sat, 16 Jan 2021 19:01:38 +0200 Subject: [PATCH] improve post thumbnails --- src/components/postCard/view/postCardView.js | 7 +++++-- .../postListItem/view/postListItemStyles.js | 4 ++-- .../postListItem/view/postListItemView.js | 17 +++++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/components/postCard/view/postCardView.js b/src/components/postCard/view/postCardView.js index fd09abc9b..1d747f7aa 100644 --- a/src/components/postCard/view/postCardView.js +++ b/src/components/postCard/view/postCardView.js @@ -21,7 +21,7 @@ import styles from './postCardStyles'; import DEFAULT_IMAGE from '../../../assets/no_image.png'; import NSFW_IMAGE from '../../../assets/nsfw.png'; -const { width } = Dimensions.get('window'); +const { width, height } = Dimensions.get('window'); const PostCardView = ({ handleOnUserPress, @@ -106,7 +106,10 @@ const PostCardView = ({ {!isHideImage && ( { const actionSheet = useRef(null); - + const [calcImgHeight, setCalcImgHeight] = useState(0); // Component Life Cycles // Component Functions @@ -60,7 +62,14 @@ const PostListItemView = ({ handleOnPressItem(id)}> - + + setCalcImgHeight((evt.nativeEvent.height / evt.nativeEvent.width) * width) + } + /> {title} {summary}