2

I need to know which these two methods is better for implementing high performance list with huge dataset.

Scrollview list : http://blog.getchop.io/2016/03/26/fast-and-fluid-infinite-list-with-react-native/

ListView : https://github.com/remobile/react-native-refresh-infinite-listview

1 Answer 1

5

In your case, the main difference between ListView and ScrollView that you should pay particular attention to is how the component renders the child element. ScrollView renders its child elements all at once. ListView has a few additional features that allows you to smoothly scroll down a list of potentially infinite number of elements. Quoting the documentation, here are the performance enhancing features in ListView:

  1. Only re-render changed rows - the rowHasChanged function provided to the data source tells the ListView if it needs to re-render a row because the source data has changed - see ListViewDataSource for more details.

  2. Rate-limited row rendering - By default, only one row is rendered per event-loop (customizable with the pageSize prop). This breaks up the work into smaller chunks to reduce the chance of dropping frames while rendering rows.

Rendering many dynamic data using ScrollView will definitely impact memory usage and performance, because it renders all child components at once and it will re-render components even if the data has not changed. So, if you only can use either of the two in this case, use ListView component.

If you are using RN v >= 0.43, then the best option is to use FlatList component. The main advantage of using this is that it renders your component only when it's needed (lazy loading).

For more in depth explanation, I highly recommend the official RN documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.