-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters