Skip to content

Commit

Permalink
fix: initial lazy position on ios
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed Feb 8, 2021
1 parent 1367c66 commit 56789c1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/FlatList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { FlatList as RNFlatList, FlatListProps } from 'react-native'

import { AnimatedFlatList } from './helpers'
import { AnimatedFlatList, IS_IOS } from './helpers'
import {
useChainCallback,
useCollapsibleStyle,
Expand All @@ -22,7 +22,12 @@ function FlatListImpl<R>(
passRef: React.Ref<RNFlatList>
): React.ReactElement {
const name = useTabNameContext()
const { setRef, setContentHeights, contentInset } = useTabsContext()
const {
setRef,
setContentHeights,
contentInset,
scrollYCurrent,
} = useTabsContext()
const ref = useSharedAnimatedRef<RNFlatList<unknown>>(passRef)
const scrollHandler = useScrollHandlerY(name)
const {
Expand Down Expand Up @@ -58,6 +63,10 @@ function FlatListImpl<R>(
onContentSizeChange={scrollContentSizeChangeHandlers}
scrollEventThrottle={16}
contentInset={{ top: contentInset }}
contentOffset={{
y: IS_IOS ? -contentInset + scrollYCurrent.value : 0,
x: 0,
}}
/>
)
}
Expand Down

0 comments on commit 56789c1

Please sign in to comment.