1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
Zhiyuan Zheng
2021-04-19 17:15:52 +02:00
parent 292101ab30
commit 7a12792393
5 changed files with 22 additions and 8 deletions

View File

@ -81,13 +81,17 @@ const GracefullyImage = React.memo(
const previewView = useMemo(
() =>
uri.preview && !imageLoaded ? (
// Android flickrs between transition, thus keep showing the preview image
uri.preview ? (
<Image
source={{ uri: uri.preview }}
style={[{ flex: 1 }, imageStyle]}
style={[
styles.placeholder,
{ backgroundColor: theme.shimmerDefault }
]}
/>
) : null,
[imageLoaded]
[]
)
const originalView = useMemo(
() => (
@ -104,12 +108,19 @@ const GracefullyImage = React.memo(
if (hidden || !imageLoaded) {
if (blurhash) {
return (
<Blurhash decodeAsync blurhash={blurhash} style={styles.blurhash} />
<Blurhash
decodeAsync
blurhash={blurhash}
style={styles.placeholder}
/>
)
} else {
return (
<View
style={[styles.blurhash, { backgroundColor: theme.disabled }]}
style={[
styles.placeholder,
{ backgroundColor: theme.shimmerDefault }
]}
/>
)
}
@ -146,7 +157,7 @@ const GracefullyImage = React.memo(
)
const styles = StyleSheet.create({
blurhash: {
placeholder: {
width: '100%',
height: '100%',
position: 'absolute'