From 3727f0e25264fd20f4709782204fa5466a53598b Mon Sep 17 00:00:00 2001 From: Zhiyuan Zheng Date: Wed, 24 Mar 2021 23:46:07 +0100 Subject: [PATCH] Fixed #81 --- src/components/Timeline.tsx | 1 + src/components/Timeline/Refresh.tsx | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Timeline.tsx b/src/components/Timeline.tsx index c485485f..bc9d8f59 100644 --- a/src/components/Timeline.tsx +++ b/src/components/Timeline.tsx @@ -128,6 +128,7 @@ const Timeline: React.FC = ({ return ( <> > queryKey: QueryKeyTimeline scrollY: Animated.SharedValue fetchingType: Animated.SharedValue<0 | 1 | 2> @@ -40,6 +41,7 @@ export const SEPARATION_Y_2 = -( ) const TimelineRefresh: React.FC = ({ + flRef, queryKey, scrollY, fetchingType, @@ -137,6 +139,10 @@ const TimelineRefresh: React.FC = ({ } ) } + const callRefetch = async () => { + await refetch() + setTimeout(() => flRef.current?.scrollToOffset({ offset: 1 }), 50) + } const [textRight, setTextRight] = useState(0) const arrowY = useAnimatedStyle(() => ({ @@ -225,7 +231,7 @@ const TimelineRefresh: React.FC = ({ break case 2: runOnJS(prepareRefetch)() - runOnJS(refetch)() + runOnJS(callRefetch)() break } },