I have this long VirtualizedList in my React Native project:
<VirtualizedList
horizontal
data={pages}
pagingEnabled
windowSize={2}
initialNumToRender={3}
maxToRenderPerBatch={1}
initialScrollIndex={page}
onMomentumScrollEnd={onScrollEnd}
getItemCount={data => data.length}
keyExtractor={(_, i) => i + ''}
getItemLayout={(_, index) => ({
length: width,
offset: width * index,
index
})}
getItem={(_, index) => ({index})}
renderItem={renderPage}
/>
Right now, it is rendering 3 items before and 2 items after the current page.
My question is:
Can you specify exactly which indexes should be rendered?
Because i have a header that lets the user jump to a specific index, and i can anticipate which index could be next.