mirror of
https://github.com/tooot-app/app
synced 2025-02-18 04:40:57 +01:00
Image viewer use blurhash as loading placeholder
This commit is contained in:
parent
b0b7a7567b
commit
516bb1e67d
3
src/@types/react-navigation.d.ts
vendored
3
src/@types/react-navigation.d.ts
vendored
@ -58,9 +58,10 @@ declare namespace Nav {
|
|||||||
imageUrls: {
|
imageUrls: {
|
||||||
id: Mastodon.Attachment['id']
|
id: Mastodon.Attachment['id']
|
||||||
url: Mastodon.AttachmentImage['url']
|
url: Mastodon.AttachmentImage['url']
|
||||||
|
remote_url?: Mastodon.AttachmentImage['remote_url']
|
||||||
|
blurhash: Mastodon.AttachmentImage['blurhash']
|
||||||
width?: number
|
width?: number
|
||||||
height?: number
|
height?: number
|
||||||
remote_url?: Mastodon.AttachmentImage['remote_url']
|
|
||||||
}[]
|
}[]
|
||||||
id: Mastodon.Attachment['id']
|
id: Mastodon.Attachment['id']
|
||||||
}
|
}
|
||||||
|
@ -102,11 +102,7 @@ const GracefullyImage = React.memo(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
style={[
|
style={[style, dimension, { backgroundColor: theme.shimmerDefault }]}
|
||||||
style,
|
|
||||||
dimension,
|
|
||||||
{ backgroundColor: theme.backgroundOverlayDefault }
|
|
||||||
]}
|
|
||||||
{...(onPress
|
{...(onPress
|
||||||
? hidden
|
? hidden
|
||||||
? { disabled: true }
|
? { disabled: true }
|
||||||
@ -130,9 +126,7 @@ const styles = StyleSheet.create({
|
|||||||
blurhash: {
|
blurhash: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
position: 'absolute',
|
position: 'absolute'
|
||||||
top: StyleConstants.Spacing.XS / 2,
|
|
||||||
left: StyleConstants.Spacing.XS / 2
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -49,6 +49,7 @@ const TimelineAttachment = React.memo(
|
|||||||
id: attachment.id,
|
id: attachment.id,
|
||||||
url: attachment.url,
|
url: attachment.url,
|
||||||
remote_url: attachment.remote_url,
|
remote_url: attachment.remote_url,
|
||||||
|
blurhash: attachment.blurhash,
|
||||||
width: attachment.meta?.original?.width,
|
width: attachment.meta?.original?.width,
|
||||||
height: attachment.meta?.original?.height
|
height: attachment.meta?.original?.height
|
||||||
})
|
})
|
||||||
|
@ -93,6 +93,7 @@ const ImageItem = ({
|
|||||||
original: imageSrc.url,
|
original: imageSrc.url,
|
||||||
remote: imageSrc.remote_url
|
remote: imageSrc.remote_url
|
||||||
}}
|
}}
|
||||||
|
blurhash={imageSrc.blurhash}
|
||||||
{...((!imageSrc.width || !imageSrc.height) && {
|
{...((!imageSrc.width || !imageSrc.height) && {
|
||||||
setImageDimensions
|
setImageDimensions
|
||||||
})}
|
})}
|
||||||
|
@ -148,6 +148,7 @@ const ImageItem = ({
|
|||||||
original: imageSrc.url,
|
original: imageSrc.url,
|
||||||
remote: imageSrc.remote_url
|
remote: imageSrc.remote_url
|
||||||
}}
|
}}
|
||||||
|
blurhash={imageSrc.blurhash}
|
||||||
{...((!imageSrc.width || !imageSrc.height) && {
|
{...((!imageSrc.width || !imageSrc.height) && {
|
||||||
setImageDimensions
|
setImageDimensions
|
||||||
})}
|
})}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user