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 () => {
|
const onRefresh = useCallback(async () => {
|
||||||
|
if (disablePullToRefresh) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setRefreshing(true);
|
setRefreshing(true);
|
||||||
if (location === Screens.CHANNEL && channelId) {
|
if (location === Screens.CHANNEL && channelId) {
|
||||||
await fetchPosts(serverUrl, channelId);
|
await fetchPosts(serverUrl, channelId);
|
||||||
|
|
@ -170,7 +173,7 @@ const PostList = ({
|
||||||
await fetchPostThread(serverUrl, rootId, options);
|
await fetchPostThread(serverUrl, rootId, options);
|
||||||
}
|
}
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
}, [channelId, location, posts, rootId]);
|
}, [channelId, location, posts, rootId, disablePullToRefresh]);
|
||||||
|
|
||||||
const onScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
const onScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||||
const {y} = event.nativeEvent.contentOffset;
|
const {y} = event.nativeEvent.contentOffset;
|
||||||
|
|
@ -357,7 +360,7 @@ const PostList = ({
|
||||||
testID={`${testID}.flat_list`}
|
testID={`${testID}.flat_list`}
|
||||||
inverted={true}
|
inverted={true}
|
||||||
refreshing={refreshing}
|
refreshing={refreshing}
|
||||||
onRefresh={disablePullToRefresh ? undefined : onRefresh}
|
onRefresh={onRefresh}
|
||||||
/>
|
/>
|
||||||
{location !== Screens.PERMALINK &&
|
{location !== Screens.PERMALINK &&
|
||||||
<ScrollToEndView
|
<ScrollToEndView
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue