Pull useAnimatedScrollHandler back up (#1858)
* Revert "Pull animated scroll handler down from pager" This reverts commit ecebb78e40148b9160f832d26ada1d366551b645. * Only handle onScroll for current page
This commit is contained in:
parent
fb4f5709c4
commit
487d871cfd
3 changed files with 26 additions and 47 deletions
|
@ -2,7 +2,6 @@ import React, {useCallback, useMemo} from 'react'
|
|||
import {
|
||||
ActivityIndicator,
|
||||
FlatList,
|
||||
NativeScrollEvent,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
View,
|
||||
|
@ -11,7 +10,6 @@ import {useFocusEffect} from '@react-navigation/native'
|
|||
import {NativeStackScreenProps, CommonNavigatorParams} from 'lib/routes/types'
|
||||
import {useNavigation} from '@react-navigation/native'
|
||||
import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
|
||||
import {useAnimatedScrollHandler} from 'react-native-reanimated'
|
||||
import {observer} from 'mobx-react-lite'
|
||||
import {RichText as RichTextAPI} from '@atproto/api'
|
||||
import {withAuthRequired} from 'view/com/auth/withAuthRequired'
|
||||
|
@ -35,6 +33,7 @@ import {useStores} from 'state/index'
|
|||
import {usePalette} from 'lib/hooks/usePalette'
|
||||
import {useSetTitle} from 'lib/hooks/useSetTitle'
|
||||
import {useWebMediaQueries} from 'lib/hooks/useWebMediaQueries'
|
||||
import {OnScrollCb} from 'lib/hooks/useOnMainScroll'
|
||||
import {NavigationProp} from 'lib/routes/types'
|
||||
import {toShareUrl} from 'lib/strings/url-helpers'
|
||||
import {shareUrl} from 'lib/sharing'
|
||||
|
@ -555,7 +554,7 @@ const Header = observer(function HeaderImpl({
|
|||
|
||||
interface FeedSectionProps {
|
||||
feed: PostsFeedModel
|
||||
onScroll: (e: NativeScrollEvent) => void
|
||||
onScroll: OnScrollCb
|
||||
headerHeight: number
|
||||
isScrolledDown: boolean
|
||||
}
|
||||
|
@ -579,14 +578,13 @@ const FeedSection = React.forwardRef<SectionRef, FeedSectionProps>(
|
|||
return <EmptyState icon="feed" message="This feed is empty!" />
|
||||
}, [])
|
||||
|
||||
const scrollHandler = useAnimatedScrollHandler({onScroll})
|
||||
return (
|
||||
<View>
|
||||
<Feed
|
||||
testID="listFeed"
|
||||
feed={feed}
|
||||
scrollElRef={scrollElRef}
|
||||
onScroll={scrollHandler}
|
||||
onScroll={onScroll}
|
||||
scrollEventThrottle={1}
|
||||
renderEmptyState={renderPostsEmpty}
|
||||
headerOffset={headerHeight}
|
||||
|
@ -610,7 +608,7 @@ interface AboutSectionProps {
|
|||
isCurateList: boolean | undefined
|
||||
isOwner: boolean | undefined
|
||||
onPressAddUser: () => void
|
||||
onScroll: (e: NativeScrollEvent) => void
|
||||
onScroll: OnScrollCb
|
||||
headerHeight: number
|
||||
isScrolledDown: boolean
|
||||
}
|
||||
|
@ -741,7 +739,6 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
|
|||
)
|
||||
}, [])
|
||||
|
||||
const scrollHandler = useAnimatedScrollHandler({onScroll})
|
||||
return (
|
||||
<View>
|
||||
<ListItems
|
||||
|
@ -751,7 +748,7 @@ const AboutSection = React.forwardRef<SectionRef, AboutSectionProps>(
|
|||
renderEmptyState={renderEmptyState}
|
||||
list={list}
|
||||
headerOffset={headerHeight}
|
||||
onScroll={scrollHandler}
|
||||
onScroll={onScroll}
|
||||
scrollEventThrottle={1}
|
||||
/>
|
||||
{isScrolledDown && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue