ListView leaving gaps when re-rendering
See original GitHub issueI have a ListView that dynamically changes data based on a filter. When the user presses a button on the side menu, the data will filter out some of the objects. However, when the ListView re-renders, it seems to leave large gaps. I feel that this is a bug, as I’m using a straightforward implementation.
renderRow = (item) => {
const tempArray = []
if (item.events.length) {
tempArray.push(item)
} else {
return null
}
return (
<View
style={[styles.listTitle, { backgroundColor: '#FFF', padding: 8}]} host="eventsList">
<Text>{tempArray[0].name}</Text>
</View>
)
}
<ListView
style={{backgroundColor: 'white'}}
name="eventsList"
dataSource={this.state.dataSource}
renderRow={this.renderRow}
scrollRenderAheadDistance={200}
renderDistance={100}
pageSize={1}
initialListSize={10}
stickyHeaderIndices={[]}
onEndReachedThreshold={100}
removeClippedSubviews
automaticallyAdjustContentInsets={false}
/>
React Native version: 0.39.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Flutter: ListView has gap at beginning - Stack Overflow
I've started with Flutter a few months ago and trying to implement my first app. The app should display a simple scrollable profile...
Read more >Optimizing Flatlist Configuration - React Native
The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting in your list...
Read more >14. Consuming events from the model layer
Re-rendering views in response to data changes. When data changes, we get a change event from the model layer. In response, we would...
Read more >ASP.NET Core Razor components - Microsoft Learn
Learn how to create and use Razor components in Blazor apps, including guidance on Razor syntax, component naming, namespaces, and component ...
Read more >Visualforce in Practice - Salesforce Developers
States include component tree, rerendering, components and other housekeeping data ... and will fill in the gaps left by the Force.com Workbook.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve had similar problems with huge datasets the only way I was able to make it work was clear the datasource.
First:
dataSource.cloneWithRows([]);
Second run:dataSource.cloneWithRows(items);
This probably has a huge impact on performance but atleast my rows now render properly on multiple runs
Related image:
Closing as ListView is deprecated in 0.43. Use FlatList.