Skip to content

Commit

Permalink
Merge pull request #27739 from dukenv0307/fix/26882
Browse files Browse the repository at this point in the history
Fix: Adding zoom scale condition to profile image to prevent the App from glitches when opening a smaller profile pic from the user details page
  • Loading branch information
Li357 authored Sep 21, 2023
2 parents 04215cb + 62266ba commit e52f21a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ImageView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,14 +232,14 @@ function ImageView({isAuthTokenRequired, url, fileName}) {
source={{uri: url}}
isAuthTokenRequired={isAuthTokenRequired}
// Hide image until finished loading to prevent showing preview with wrong dimensions.
style={isLoading ? undefined : [styles.w100, styles.h100]}
style={isLoading || zoomScale === 0 ? undefined : [styles.w100, styles.h100]}
// When Image dimensions are lower than the container boundary(zoomscale <= 1), use `contain` to render the image with natural dimensions.
// Both `center` and `contain` keeps the image centered on both x and y axis.
resizeMode={zoomScale > 1 ? Image.resizeMode.center : Image.resizeMode.contain}
onLoadStart={imageLoadingStart}
onLoad={imageLoad}
/>
{isLoading && <FullscreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}
{(isLoading || zoomScale === 0) && <FullscreenLoadingIndicator style={[styles.opacity1, styles.bgTransparent]} />}
</View>
);
}
Expand Down

0 comments on commit e52f21a

Please sign in to comment.