Created
September 13, 2021 12:00
-
-
Save prabhat1707/604f0c9a24f7c6c68e922b3262208792 to your computer and use it in GitHub Desktop.
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
const renderItem = ({ item }) => (<Text key={item.key}>{item.key}</Text>); | |
// we set the height of item is fixed | |
const getItemLayout = (data, index) => ( | |
{length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index} | |
); | |
const items = [{ key: 'a' }, { key: 'b'}, ...+400]; | |
function render () => ( | |
<FlatList | |
data={items} | |
renderItem={renderItem} | |
getItemLayout={getItemLayout} | |
initialNumToRender={5} | |
maxToRenderPerBatch={10} | |
windowSize={10} | |
/> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment