I am trying to display element in a grid. Each line should contain as much as possible of elements depending on the screen size. I found a similar post in the forum but the code seems old and I am very new with react native, I was not able to run it. Can you please help me? This is my current code
export default class Container extends Component {
constructor() {
super();
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(['row 1', 'row 2']),
};
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={(rowData) => <Text>{rowData}</Text>}
/>
);
}
}
I get an error on the line dataSource={this.state.dataSource}
: undefined is not an object (evaluating 'new _reactNativeElements.ListView.DataSource