mirror of
https://github.com/tooot-app/app
synced 2025-03-29 01:40:09 +01:00
Improve refresh loading
This commit is contained in:
parent
2d9f7a90cc
commit
74badd94cb
@ -61,7 +61,7 @@ const TimelineRefresh: React.FC<Props> = ({
|
||||
const prevStatusId = useRef<Mastodon.Status['id']>()
|
||||
|
||||
const queryClient = useQueryClient()
|
||||
const { refetch } = useTimelineQuery({ ...queryKey[1] })
|
||||
const { refetch, isFetched } = useTimelineQuery({ ...queryKey[1] })
|
||||
|
||||
const { t } = useTranslation('componentTimeline')
|
||||
const { colors } = useTheme()
|
||||
@ -118,10 +118,11 @@ const TimelineRefresh: React.FC<Props> = ({
|
||||
}
|
||||
},
|
||||
data => {
|
||||
if (data) {
|
||||
if (data && isFetched) {
|
||||
runOnJS(haptics)('Light')
|
||||
}
|
||||
}
|
||||
},
|
||||
[isFetched]
|
||||
)
|
||||
|
||||
const fetchAndScrolled = useSharedValue(false)
|
||||
@ -246,6 +247,8 @@ const TimelineRefresh: React.FC<Props> = ({
|
||||
[]
|
||||
)
|
||||
|
||||
if (!isFetched) return null
|
||||
|
||||
return (
|
||||
<Animated.View
|
||||
style={{
|
||||
|
@ -228,11 +228,12 @@ const Timeline: React.FC<Props> = ({
|
||||
)
|
||||
}
|
||||
viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current}
|
||||
{...(!isLoading && {
|
||||
maintainVisibleContentPosition: {
|
||||
minIndexForVisible: 0
|
||||
}
|
||||
})}
|
||||
{...(!isLoading &&
|
||||
!isFetching && {
|
||||
maintainVisibleContentPosition: {
|
||||
minIndexForVisible: 0
|
||||
}
|
||||
})}
|
||||
{...androidRefreshControl}
|
||||
{...customProps}
|
||||
/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user