Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix: crash when opening image in channel multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
hirbod committed Nov 20, 2023
1 parent 69bb2b5 commit 86a9c69
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,25 @@ export const ImagePreview = ({
tw="web:cursor-pointer"
transition={300}
recyclingKey={attachment.attachments[0]?.media_upload}
width={width}
height={height}
source={
fileObj.url
? {
uri: fileObj.url + "?optimizer=image&width=300&quality=50",
width: width,
height: height,
width: 300,
}
: undefined
}
placeholderContentFit={"contain"}
alt=""
style={[
{ borderRadius: 8 },
{ backgroundColor: isDark ? "#333" : "#f5f5f5" },
{ display: isViewable ? undefined : "none" },
{ width },
{ height },
style,
]}
cachePolicy={"none"}
/>
</Pressable>
{!isViewable ? (
Expand Down
20 changes: 14 additions & 6 deletions packages/app/screens/shared-element.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,29 @@ const SharedElementScreen = withColorScheme(() => {
<AnimatedImage
source={{
uri: url + "?optimizer=image&width=1000",
width: 1000,
}}
placeholder={
url
? {
uri:
url + "?optimizer=image&width=300&quality=50",
width: 300,
}
: undefined
}
placeholderContentFit={"contain"}
ref={animatedRef}
placeholder={{
uri: url + "?optimizer=image&width=300",
width: normalizedImageDimensions.width,
height: normalizedImageDimensions.height,
}}
placeholderContentFit={"cover"}
style={[
{
width: normalizedImageDimensions.width,
height: normalizedImageDimensions.height,
},
animatedStyles,
]}
width={normalizedImageDimensions.width}
height={normalizedImageDimensions.height}
cachePolicy={"none"}
/>
</Reanimated.View>
</View>
Expand Down

0 comments on commit 86a9c69

Please sign in to comment.