Remove onScroll
This commit is contained in:
@@ -60,7 +60,7 @@ export const FlatList = React.forwardRef(function FlatListImpl<ItemT>(
|
|||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
onEndReached,
|
onEndReached,
|
||||||
onEndReachedThreshold,
|
onEndReachedThreshold,
|
||||||
onScroll,
|
onScroll: _unused, // Not supported on the web.
|
||||||
ListHeaderComponent,
|
ListHeaderComponent,
|
||||||
ListFooterComponent,
|
ListFooterComponent,
|
||||||
desktopFixedHeight,
|
desktopFixedHeight,
|
||||||
@@ -115,24 +115,6 @@ export const FlatList = React.forwardRef(function FlatListImpl<ItemT>(
|
|||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
if (!onScroll) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
function handleScroll(e: any) {
|
|
||||||
;(onScroll as any).current?.worklet({
|
|
||||||
...e.nativeEvent,
|
|
||||||
eventName: 'onScroll',
|
|
||||||
contentOffset: {
|
|
||||||
x: 0,
|
|
||||||
y: window.scrollY,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
window.addEventListener('scroll', handleScroll)
|
|
||||||
return () => window.removeEventListener('scroll', handleScroll)
|
|
||||||
}, [onScroll])
|
|
||||||
|
|
||||||
const onVisible = React.useCallback(() => {
|
const onVisible = React.useCallback(() => {
|
||||||
onEndReached?.({
|
onEndReached?.({
|
||||||
distanceFromEnd: onEndReachedThreshold || 0,
|
distanceFromEnd: onEndReachedThreshold || 0,
|
||||||
|
|||||||
Reference in New Issue
Block a user