Closed
Description
Description
When populating a VirtualizedList
using getItem()
(i.e. not using data
), the list only shows the first 10 items even if getItemCount()
returns a number more than 10. This seems to happen irrespective of the setting of initialNumberToRender
and windowSize
. I'd expect that you would be able to see all items in the list.
Reproduction Steps and Sample Code
export default class ListTest extends Component {
render() {
return (
<View>
<VirtualizedList
initialNumberToRender={20}
windowSize={21}
getItemCount={(data) => 365}
getItem={(data, index) => {
return { key: index };
}}
keyExtractor={(item, index) => {
return item.key;
}}
renderItem={({ item, index }) => {
return (
<View style={{height:50}}>
<Text>{item.key}</Text>
</View>
);
}}
/>
</View>
);
}
}
Solution
I peeked at the source code, but couldn't find a clear fix.
Additional Information
- React Native version: 0.43.3
- Platform: iOS
- Development Operating System: MacOS
- Dev tools: XCode 8.2.1