From d2eb7156a4ffd3c9b1a1f560f05c5125b8db1ce7 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Fri, 17 Feb 2023 18:58:43 +0100 Subject: [PATCH 1/2] Try faster append toots --- src/components/Timeline/Refresh.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Timeline/Refresh.tsx b/src/components/Timeline/Refresh.tsx index 44216d66..bc134481 100644 --- a/src/components/Timeline/Refresh.tsx +++ b/src/components/Timeline/Refresh.tsx @@ -167,11 +167,11 @@ const TimelineRefresh: React.FC = ({ prevCache.current = res.body.slice(0, -PREV_PER_BATCH) return { + ...old, pages: [ { ...res, body: res.body.slice(-PREV_PER_BATCH) }, ...old.pages.slice(0, keepPagesCount) - ], - pageParams: [{}, ...old.pageParams.slice(0, keepPagesCount)] + ] } }) @@ -189,7 +189,7 @@ const TimelineRefresh: React.FC = ({ flRef.current?.scrollToOffset({ offset: scrollY.value - 15, animated: true }) } - await new Promise(promise => setTimeout(promise, 64)) + await new Promise(promise => setTimeout(promise, 16)) queryClient.setQueryData< InfiniteData< PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]> From 73e4bdb29076ae994bd5c461788952e05fbf60e1 Mon Sep 17 00:00:00 2001 From: xmflsct Date: Fri, 17 Feb 2023 22:19:04 +0100 Subject: [PATCH 2/2] Prevent image loading flashing in conversation --- src/components/GracefullyImage.tsx | 4 +++- src/components/Timeline/Shared/Attachment/Audio.tsx | 6 +++++- src/components/Timeline/Shared/Attachment/Image.tsx | 5 ++++- src/components/Timeline/Shared/Attachment/Unsupported.tsx | 6 +++++- src/components/Timeline/Shared/Attachment/Video.tsx | 6 +++++- src/components/Timeline/Shared/Avatar.tsx | 3 ++- src/components/Timeline/Shared/Card.tsx | 3 ++- 7 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/components/GracefullyImage.tsx b/src/components/GracefullyImage.tsx index fb95f5b0..53d046ff 100644 --- a/src/components/GracefullyImage.tsx +++ b/src/components/GracefullyImage.tsx @@ -23,6 +23,7 @@ export interface Props { imageStyle?: ImageStyle dim?: boolean + withoutTransition?: boolean enableLiveTextInteraction?: boolean } @@ -36,6 +37,7 @@ const GracefullyImage = ({ style, imageStyle, dim, + withoutTransition = false, enableLiveTextInteraction = false }: Props) => { const { reduceMotionEnabled } = useAccessibility() @@ -59,7 +61,7 @@ const GracefullyImage = ({ placeholderContentFit='cover' placeholder={sources.blurhash || connectMedia(sources.preview)} source={hidden ? undefined : connectMedia(source)} - transition={{ duration: 80 }} + {...((!withoutTransition || !reduceMotionEnabled) && { transition: { duration: 120 } })} style={{ flex: 1, ...imageStyle }} onError={() => { if ( diff --git a/src/components/Timeline/Shared/Attachment/Audio.tsx b/src/components/Timeline/Shared/Attachment/Audio.tsx index 4e176df8..ca75708f 100644 --- a/src/components/Timeline/Shared/Attachment/Audio.tsx +++ b/src/components/Timeline/Shared/Attachment/Audio.tsx @@ -5,8 +5,9 @@ import { connectMedia } from '@utils/api/helpers/connect' import { StyleConstants } from '@utils/styles/constants' import { useTheme } from '@utils/styles/ThemeManager' import { Audio } from 'expo-av' -import React, { useCallback, useEffect, useRef, useState } from 'react' +import React, { useCallback, useContext, useEffect, useRef, useState } from 'react' import { AppState, AppStateStatus, View } from 'react-native' +import StatusContext from '../Context' import AttachmentAltText from './AltText' import { aspectRatio } from './dimensions' @@ -18,6 +19,7 @@ export interface Props { } const AttachmentAudio: React.FC = ({ total, index, sensitiveShown, audio }) => { + const { inThread } = useContext(StatusContext) const { colors } = useTheme() const [audioPlayer, setAudioPlayer] = useState() @@ -88,6 +90,7 @@ const AttachmentAudio: React.FC = ({ total, index, sensitiveShown, audio height: '100%' }} dim + withoutTransition={inThread} /> ) : null ) : ( @@ -100,6 +103,7 @@ const AttachmentAudio: React.FC = ({ total, index, sensitiveShown, audio }} style={{ position: 'absolute', width: '100%', height: '100%' }} dim + withoutTransition={inThread} /> ) : null}