blob: 942f0404ab7fdb6f7c303005a9499c44cb28c5ba (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
|
import React from 'react'
import {Dimensions} from 'react-native'
const MIN_POST_HEIGHT = 100
export function useInitialNumToRender(minItemHeight: number = MIN_POST_HEIGHT) {
return React.useMemo(() => {
const screenHeight = Dimensions.get('window').height
return Math.ceil(screenHeight / minItemHeight) + 1
}, [minItemHeight])
}
|