Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data: [ {id: 0, key: 'Key1', checked: false }, ... }]
- onCheckBoxChange(id) {
- let arr = Array.from(Object.create(this.state.data));
- arr[id].checked = !arr[id].checked;
- this.setState({
- data: arr
- })
- }
- render() {
- return (
- <Container>
- <Content>
- <List dataArray={this.state.data}
- renderRow={(item) =>
- <View>
- <ListItem>
- <CheckBox checked={ this.state.data[item.id].checked }
- onPress={()=> this.onCheckBoxChange(item.id)}/>
- <Text>{item.key}</Text>
- </ListItem>
- </View>
- }>
- </List>
- </Content>
- </Container>
- )
- }
- }
Add Comment
Please, Sign In to add comment