limiting image height while avoiding white spacing

This commit is contained in:
Nouman Tahir 2021-03-11 15:15:39 +05:00
parent e3833cc782
commit 92a506a061

View File

@ -106,10 +106,14 @@ const PostCardView = ({
styles.thumbnail,
{
width: dim.width - 18,
height: calcImgHeight,
height: Math.min(calcImgHeight, dim.height),
},
]}
resizeMode={FastImage.resizeMode.contain}
resizeMode={
calcImgHeight < dim.height
? FastImage.resizeMode.contain
: FastImage.resizeMode.cover
}
onLoad={(evt) => {
setCalcImgHeight((evt.nativeEvent.height / evt.nativeEvent.width) * dim.width - 18);
}}