From 7fd79702371e3d7829be2188c2212c090bf76670 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 14 Dec 2023 02:48:20 +0000 Subject: Make scroll handling contextual (#2200) * Add an intermediate List component * Fix type * Add onScrolledDownChange * Port pager to use onScrolledDownChange * Fix on mobile * Don't pass down onScroll (replacement TBD) * Remove resetMainScroll * Replace onMainScroll with MainScrollProvider * Hook ScrollProvider to pager * Fix the remaining special case * Optimize a bit * Enforce that onScroll cannot be passed * Keep value updated even if no handler * Also memo it --- src/view/com/post-thread/PostThread.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/view/com/post-thread/PostThread.tsx') diff --git a/src/view/com/post-thread/PostThread.tsx b/src/view/com/post-thread/PostThread.tsx index 051bc7849..f27da331f 100644 --- a/src/view/com/post-thread/PostThread.tsx +++ b/src/view/com/post-thread/PostThread.tsx @@ -8,7 +8,8 @@ import { View, } from 'react-native' import {AppBskyFeedDefs} from '@atproto/api' -import {CenteredView, FlatList} from '../util/Views' +import {CenteredView} from '../util/Views' +import {List, ListMethods} from '../util/List' import { FontAwesomeIcon, FontAwesomeIconStyle, @@ -140,7 +141,7 @@ function PostThreadLoaded({ const {_} = useLingui() const pal = usePalette('default') const {isTablet, isDesktop} = useWebMediaQueries() - const ref = useRef(null) + const ref = useRef(null) const highlightedPostRef = useRef(null) const needsScrollAdjustment = useRef( !isNative || // web always uses scroll adjustment @@ -335,7 +336,7 @@ function PostThreadLoaded({ ) return ( -