1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Allow Android to have moving image

This commit is contained in:
Zhiyuan Zheng
2022-06-16 23:22:28 +02:00
parent 3cbcb6b3f9
commit 8d0fc94303
3 changed files with 24 additions and 10 deletions

View File

@ -4,7 +4,7 @@
"native": "220603", "native": "220603",
"major": 4, "major": 4,
"minor": 1, "minor": 1,
"patch": 2, "patch": 3,
"expo": "45.0.0" "expo": "45.0.0"
}, },
"description": "tooot app for Mastodon", "description": "tooot app for Mastodon",

View File

@ -5,12 +5,14 @@ import {
AccessibilityProps, AccessibilityProps,
Image, Image,
ImageStyle, ImageStyle,
Platform,
Pressable, Pressable,
StyleProp, StyleProp,
StyleSheet, StyleSheet,
View, View,
ViewStyle ViewStyle
} from 'react-native' } from 'react-native'
import FastImage from 'react-native-fast-image'
import { Blurhash } from 'react-native-blurhash' import { Blurhash } from 'react-native-blurhash'
// blurhas -> if blurhash, show before any loading succeed // blurhas -> if blurhash, show before any loading succeed
@ -125,13 +127,24 @@ const GracefullyImage = ({
]} ]}
/> />
) : null} ) : null}
<Image {Platform.OS === 'ios' ? (
fadeDuration={0} <Image
source={source} fadeDuration={0}
style={[{ flex: 1 }, imageStyle]} source={source}
onLoad={onLoad} style={[{ flex: 1 }, imageStyle]}
onError={onError} onLoad={onLoad}
/> onError={onError}
/>
) : (
<FastImage
fadeDuration={0}
source={source}
// @ts-ignore
style={[{ flex: 1 }, imageStyle]}
onLoad={onLoad}
onError={onError}
/>
)}
{blurhashView} {blurhashView}
</Pressable> </Pressable>
) )

View File

@ -2,7 +2,8 @@ import Button from '@components/Button'
import { useAccessibility } from '@utils/accessibility/AccessibilityManager' import { useAccessibility } from '@utils/accessibility/AccessibilityManager'
import { useTheme } from '@utils/styles/ThemeManager' import { useTheme } from '@utils/styles/ThemeManager'
import React from 'react' import React from 'react'
import { Dimensions, Image, View } from 'react-native' import { Dimensions, View } from 'react-native'
import FastImage from 'react-native-fast-image'
import { useSafeAreaInsets } from 'react-native-safe-area-context' import { useSafeAreaInsets } from 'react-native-safe-area-context'
export interface Props { export interface Props {
@ -18,7 +19,7 @@ const AccountHeader = React.memo(
return ( return (
<View> <View>
<Image <FastImage
source={{ source={{
uri: reduceMotionEnabled ? account?.header_static : account?.header uri: reduceMotionEnabled ? account?.header_static : account?.header
}} }}