Fix erratic behavior of pull to refresh on threads (#7911)
This commit is contained in:
parent
4084b21165
commit
ca7915e2e3
1 changed files with 5 additions and 2 deletions
|
|
@ -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<NativeScrollEvent>) => {
|
||||
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 &&
|
||||
<ScrollToEndView
|
||||
|
|
|
|||
Loading…
Reference in a new issue