I want to pass an array to the cloneWithRows method. below is the code
export default class FirstReactNativeApp extends Component {
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
modalVisible: false,
todoText:'',
todoListArray:['foo 1','foo 2'],
dataSource: ds.cloneWithRows(this.state.todoListArray)
};
}
This is the Listview
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{JSON.stringify(rowData)</Text>}
/>
I'm getting the error undefined is not an object(evaluating '_this.state.todoListArray')
I'm not able to resolve this.Please guide me!
Thanks