The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Create a List of Items with a React Native ListView

Create a List of Items with a React Native ListView

5:57
In this lesson we'll use the ListView component to render a list of items that were entered. We'll show how to setup a ListView.DataSource and how to render custom rows with performance in mind.
Watch this lesson now
Avatar
egghead.io

In this lesson we'll use the ListView component to render a list of items that were entered. We'll show how to setup a ListView.DataSource and how to render custom rows with performance in mind.

Avatar
Guven

Im stuck 2:45 minutes into the video, getting an error 'undefined is not an object (evaluating 'dataSource.rowIdentities')

Please help.

In reply to egghead.io
Avatar
Jason Brown

Hi, I'm happy to help out but I don't have enough information to go off. If put your code somewhere I can review it, also the code is on github so you can do a comparison and find out where the issue might be.

It looks like you may not be initializing the DataSource with an empty array, or you may not be passing it into the ListView as dataSource.

Here is a stack overflow topic with the issue http://stackoverflow.com/questions/35472324/react-native-evaluating-datasource-rowidentities

In reply to Guven
Avatar
orassr

Hi ! stuck at the same point
You can review my code :
https://github.com/orassr/ReactNative

Avatar
Jason Brown

I've gone ahead and added in syntax fixes as a PR https://github.com/orassr/ReactNative/pull/1

In reply to orassr
Avatar
Jason Brown

For those watching, it appears I misspelled Keyboard.dismiss as Keyboard.dimiss.

This is no longer needed either as you can pass keyboardDismissMode="on-drag" as found in the React Native ScrollView documentation here https://facebook.github.io/react-native/docs/scrollview.html#props

Avatar
orassr

Thank you for the quick respond !

In reply to Jason Brown
Avatar
orassr

still not working after changes
setState(...):Expected the last optional callback arguments be a function. instead received: Array(keys:0).

In reply to orassr
Avatar
Jason Brown

You are calling setState here https://github.com/orassr/ReactNative/blob/master/app.js#L51 instead of setSource.

Also here https://github.com/orassr/ReactNative/blob/master/row.js#L8 you are referencing style.text and it should be styles.text. If you fix those it will work.

In reply to orassr
Avatar
orassr

Fixed ! thank you for your patience.

In reply to Jason Brown
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?