react-native: Undefined is not an object (evaluating 'dataSource.rowIdentities')

When I use ListView to show my data, a question occur to me. it throws Undefined is not an object (evaluating ‘dataSource.rowIdentities’). Here is my code.

` constructor(props) { super(props); this.handleChange = this.handleChangeFunc.bind(this); this._onCancel = this._onCancelFunc.bind(this); alert(21); var ds = new ListView.DataSource({ rowHasChanged: (oldRow, newRow) => oldRow !== newRow, }); this.state = { textInputValue: ‘’, dataSourse: ds.cloneWithRows([‘row1’, ‘row2’, ‘row3’]), }; } … render() { return ( <ListView dataSource={this.state.dataSource}

                 renderRow={(rowData) => <Text>{rowData}</Text>}
               />
        </View>
    );
}

`

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 27 (24 by maintainers)

Most upvoted comments

@williamlk not sure if it was the same for you, but it was a spelling error for me

<ListView
     datasource={this.state.datasource}

note the lack of capital S in dataSource ListView prop

edit: spelling mistake