question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ListView leaving gaps when re-rendering

See original GitHub issue

I 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 screen shot 2017-01-02 at 6 49 06 pm

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JensDeberghcommented, Feb 22, 2017

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:

screen shot 2017-02-21 at 4 36 19 pm

0reactions
hramoscommented, Mar 31, 2017

Closing as ListView is deprecated in 0.43. Use FlatList.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found