Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListView component easily displays performance issues #127

Closed
jaygarcia opened this issue Mar 5, 2015 · 8 comments
Closed

ListView component easily displays performance issues #127

jaygarcia opened this issue Mar 5, 2015 · 8 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jaygarcia
Copy link
Contributor

Team: This type of performance issue is something that will not be accepted by the community when this thing launches. The slowest HTML5 frameworks can render items way faster than this.

Demo: http://www.screencast.com/t/mQpzX1ZAE2

This issue can be replicated on an iPhone6.

dfq

@nick
Copy link

nick commented Mar 5, 2015

Jay, I'm pretty sure your implementation is funky if you're getting that type of performance. Are you sure you're doing things the 'React' way?

@amccloud
Copy link

amccloud commented Mar 5, 2015

@jaygarcia Can you share an example project I can run on my device?

@jaygarcia
Copy link
Contributor Author

@nick -- If the 'React way' isn't what's in the examples (or below), I don't know what is.

@amccloud, the below gist is a /slightly/ modified version of the UIExplorer's "ListViewSimpleExample.js" file, removing the need for "UIExplorerPage"

https://gist.githubusercontent.com/jaygarcia/e3e6dd0a2e71cf7ffd7b/raw/0f9ccee35448c1e6b0fc7374decc4b4bfddc019e/gistfile1.js

The following is the root view, implements "ListView.js" (above).

'use strict';

var React = require('react-native'),
    styles = require('./Styles'),
    MyListView = require('./ListView.js');

var {
    AppRegistry,
    View,
    Text,
    TouchableHighlight
} = React;


var DemoApp = React.createClass({
    render : function() {
        var me = this;
        return (
            <View style={styles.container}>
                <MyListView></MyListView>
            </View>
        );
    }
});

AppRegistry.registerComponent('DemoApp', () => DemoApp);

module.exports = DemoApp;

@ide
Copy link
Contributor

ide commented Mar 6, 2015

I believe the ListView renders one cell at a time after the initial render. You can tell it to render 100 cells per rAF or ensure the data source is populated the first time you render the ListView.

@jaygarcia
Copy link
Contributor Author

Fantastic. Just noticed the following in the ListView.js file.

  getDefaultProps: function() {
    return {
      initialListSize: DEFAULT_INITIAL_ROWS,
      pageSize: DEFAULT_PAGE_SIZE,
      scrollRenderAheadDistance: DEFAULT_SCROLL_RENDER_AHEAD,
      onEndReachedThreshold: DEFAULT_END_REACHED_THRESHOLD,
    };
  },

@jaygarcia
Copy link
Contributor Author

Resolved via the following

<ListView dataSource={this.state.dataSource} initialListSize={100} renderRow={this._renderRow}/>

Though, DEFAULT_INITIAL_ROWS should probably be > 15 or so in Components/ListView/ListView.js

@sahrens
Copy link
Contributor

sahrens commented Mar 6, 2015

Yeah, ideally we could figure more of this out automatically rather than you needing to tweak the params manually. The defaults are optimized for Groups which have much taller rows.

On Mar 5, 2015, at 4:44 PM, Jay Garcia notifications@github.com wrote:

Closed #127.


Reply to this email directly or view it on GitHub.

@sahrens
Copy link
Contributor

sahrens commented Mar 6, 2015

We're also probably going to simplify and further optimize this component significantly in the not-so-distant future - if anyone wants to take a stab at it, we were thinking of simply relying on the row components' shouldComponentUpdate methods instead of the DataSource, etc.

On Mar 5, 2015, at 4:44 PM, Jay Garcia notifications@github.com wrote:

Closed #127.


Reply to this email directly or view it on GitHub.

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants