I get my list view as well as data is rendered. But when I click/touch the checkbox it doesn't toggle the selection. It just remains on the same state as it was at the beginning.
Thanks in advance.
export default class FlatListBasics extends Component {
constructor() {
super();
this.state = {
data: [
{key: 'Devin', done: true},
{key: 'Jackson', done: true},
{key: 'James', done: true},
{key: 'Joel', done: true},
{key: 'John', done: true},
{key: 'Jillian', done: false},
{key: 'Jimmy', done: true},
{key: 'Julie', done: true}
]
}
}
_renderRow(rowData) {
return <ListItem>
<CheckBox checked={rowData.item.done} onPress={
() => {
rowData.item.done = !rowData.item.done;
return rowData;
}
}/>
<Text> {rowData.item.key}</Text>
</ListItem>
}
render() {
return (
<FlatList
data={this.state.data}
renderItem={this._renderRow}
extraData={this.state}
/>
);
}
}