Adjust FlatList performance in main feeds (#3134)
* adjust flatlist perf settings * calculate initial num to render based on screen height * adjust window size * don't react to screen height changes
This commit is contained in:
@@ -0,0 +1,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])
|
||||
}
|
||||
Reference in New Issue
Block a user