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

Improve auto fetch

This commit is contained in:
xmflsct
2023-02-08 19:22:20 +01:00
parent 724cd76647
commit 48481a4cd5
10 changed files with 30 additions and 23 deletions

View File

@ -134,15 +134,6 @@ const Timeline: React.FC<Props> = ({
{
onScroll: ({ contentOffset: { y } }) => {
scrollY.value = y
if (
y < 300 &&
!isFetchingPrev.value &&
fetchingType.value === 0 &&
shouldAutoFetch.value &&
Platform.OS === 'ios'
) {
fetchingType.value = 1
}
},
onEndDrag: ({ contentOffset: { y } }) => {
if (!disableRefresh && !isFetching) {
@ -157,6 +148,21 @@ const Timeline: React.FC<Props> = ({
},
[isFetching]
)
useAnimatedReaction(
() => scrollY.value < 600,
(curr, prev) => {
if (
curr === true &&
prev === false &&
!isFetchingPrev.value &&
fetchingType.value === 0 &&
shouldAutoFetch.value &&
Platform.OS === 'ios'
) {
fetchingType.value = 1
}
}
)
const latestMarker = useRef<string>()
const updateMarkers = useCallback(