From ca7915e2e332cca6e033ea55a1dbd684ae6c5a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Mon, 22 Apr 2024 09:55:20 +0200 Subject: [PATCH] Fix erratic behavior of pull to refresh on threads (#7911) --- app/components/post_list/post_list.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/components/post_list/post_list.tsx b/app/components/post_list/post_list.tsx index 4e05a63eb..23644b902 100644 --- a/app/components/post_list/post_list.tsx +++ b/app/components/post_list/post_list.tsx @@ -156,6 +156,9 @@ const PostList = ({ }, []); const onRefresh = useCallback(async () => { + if (disablePullToRefresh) { + return; + } setRefreshing(true); if (location === Screens.CHANNEL && channelId) { await fetchPosts(serverUrl, channelId); @@ -170,7 +173,7 @@ const PostList = ({ await fetchPostThread(serverUrl, rootId, options); } setRefreshing(false); - }, [channelId, location, posts, rootId]); + }, [channelId, location, posts, rootId, disablePullToRefresh]); const onScroll = useCallback((event: NativeSyntheticEvent) => { const {y} = event.nativeEvent.contentOffset; @@ -357,7 +360,7 @@ const PostList = ({ testID={`${testID}.flat_list`} inverted={true} refreshing={refreshing} - onRefresh={disablePullToRefresh ? undefined : onRefresh} + onRefresh={onRefresh} /> {location !== Screens.PERMALINK &&