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

Improve refresh loading

This commit is contained in:
xmflsct 2023-02-02 14:15:37 +01:00
parent 2d9f7a90cc
commit 74badd94cb
2 changed files with 12 additions and 8 deletions

View File

@ -61,7 +61,7 @@ const TimelineRefresh: React.FC<Props> = ({
const prevStatusId = useRef<Mastodon.Status['id']>() const prevStatusId = useRef<Mastodon.Status['id']>()
const queryClient = useQueryClient() const queryClient = useQueryClient()
const { refetch } = useTimelineQuery({ ...queryKey[1] }) const { refetch, isFetched } = useTimelineQuery({ ...queryKey[1] })
const { t } = useTranslation('componentTimeline') const { t } = useTranslation('componentTimeline')
const { colors } = useTheme() const { colors } = useTheme()
@ -118,10 +118,11 @@ const TimelineRefresh: React.FC<Props> = ({
} }
}, },
data => { data => {
if (data) { if (data && isFetched) {
runOnJS(haptics)('Light') runOnJS(haptics)('Light')
} }
} },
[isFetched]
) )
const fetchAndScrolled = useSharedValue(false) const fetchAndScrolled = useSharedValue(false)
@ -246,6 +247,8 @@ const TimelineRefresh: React.FC<Props> = ({
[] []
) )
if (!isFetched) return null
return ( return (
<Animated.View <Animated.View
style={{ style={{

View File

@ -228,7 +228,8 @@ const Timeline: React.FC<Props> = ({
) )
} }
viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current} viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current}
{...(!isLoading && { {...(!isLoading &&
!isFetching && {
maintainVisibleContentPosition: { maintainVisibleContentPosition: {
minIndexForVisible: 0 minIndexForVisible: 0
} }