mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Fix visual bugs
Somehow the `onError` of `react-native-fast-image` doesn't work anymore as expected. Maybe because the underlying `SDWebImage` is being patched to other versions.
This commit is contained in:
@ -53,26 +53,17 @@ const GracefullyImage = ({
|
||||
}: Props) => {
|
||||
const { reduceMotionEnabled } = useAccessibility()
|
||||
const { colors } = useTheme()
|
||||
const [originalFailed, setOriginalFailed] = useState(false)
|
||||
const [imageLoaded, setImageLoaded] = useState(false)
|
||||
|
||||
const source = originalFailed
|
||||
? { uri: uri.remote || undefined }
|
||||
: {
|
||||
uri: reduceMotionEnabled && uri.static ? uri.static : uri.original
|
||||
}
|
||||
|
||||
const source = {
|
||||
uri: reduceMotionEnabled && uri.static ? uri.static : uri.original
|
||||
}
|
||||
const onLoad = () => {
|
||||
setImageLoaded(true)
|
||||
if (setImageDimensions && source.uri) {
|
||||
Image.getSize(source.uri, (width, height) => setImageDimensions({ width, height }))
|
||||
}
|
||||
}
|
||||
const onError = () => {
|
||||
if (!originalFailed) {
|
||||
setOriginalFailed(true)
|
||||
}
|
||||
}
|
||||
|
||||
const blurhashView = useMemo(() => {
|
||||
if (hidden || !imageLoaded) {
|
||||
@ -101,10 +92,11 @@ const GracefullyImage = ({
|
||||
/>
|
||||
) : null}
|
||||
<FastImage
|
||||
source={source}
|
||||
source={{
|
||||
uri: reduceMotionEnabled && uri.static ? uri.static : uri.original
|
||||
}}
|
||||
style={[{ flex: 1 }, imageStyle]}
|
||||
onLoad={onLoad}
|
||||
onError={onError}
|
||||
/>
|
||||
{blurhashView}
|
||||
</Pressable>
|
||||
|
@ -13,6 +13,8 @@ import { useQueryClient } from '@tanstack/react-query'
|
||||
import { useSelector } from 'react-redux'
|
||||
import { checkInstanceFeature } from '@utils/slices/instancesSlice'
|
||||
import { StyleConstants } from '@utils/styles/constants'
|
||||
import { View } from 'react-native'
|
||||
import { useRoute } from '@react-navigation/native'
|
||||
|
||||
export interface Props {
|
||||
id: Mastodon.Account['id']
|
||||
@ -122,9 +124,12 @@ const RelationshipOutgoing: React.FC<Props> = ({ id }: Props) => {
|
||||
}
|
||||
}
|
||||
|
||||
const { name } = useRoute()
|
||||
const isPageNotifications = name === 'Tab-Notifications-Root'
|
||||
|
||||
return (
|
||||
<>
|
||||
{canFollowNotify && query.data?.following ? (
|
||||
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
||||
{!isPageNotifications && canFollowNotify && query.data?.following ? (
|
||||
<Button
|
||||
type='icon'
|
||||
content={query.data.notifying ? 'BellOff' : 'Bell'}
|
||||
@ -151,7 +156,7 @@ const RelationshipOutgoing: React.FC<Props> = ({ id }: Props) => {
|
||||
loading={query.isLoading || mutation.isLoading}
|
||||
disabled={query.isError || query.data?.blocked_by}
|
||||
/>
|
||||
</>
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user