mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Improve refresh loading
This commit is contained in:
		| @@ -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={{ | ||||||
|   | |||||||
| @@ -228,11 +228,12 @@ const Timeline: React.FC<Props> = ({ | |||||||
|           ) |           ) | ||||||
|         } |         } | ||||||
|         viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current} |         viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current} | ||||||
|         {...(!isLoading && { |         {...(!isLoading && | ||||||
|           maintainVisibleContentPosition: { |           !isFetching && { | ||||||
|             minIndexForVisible: 0 |             maintainVisibleContentPosition: { | ||||||
|           } |               minIndexForVisible: 0 | ||||||
|         })} |             } | ||||||
|  |           })} | ||||||
|         {...androidRefreshControl} |         {...androidRefreshControl} | ||||||
|         {...customProps} |         {...customProps} | ||||||
|       /> |       /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user