Monday, 20 January 2020
NativeBase CheckBox
import React, { Component } from 'react';
import { Image } from 'react-native';
import {
Container, Header, Title, Content, Footer,
FooterTab, Button, Left, Right, Body, Icon, Text,
Accordion, Card, CardItem, Thumbnail, ListItem,
CheckBox,
} from 'native-base';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {
check1: false,
check2: true,
check3: false,
};
}
changeCheck = (name) => {
this.setState(prevstate => {
return { [name]: !prevstate[name] }
})
}
render() {
return (
<Container>
<Header>
<Body>
<Title>Card</Title>
</Body>
</Header>
<Content>
<ListItem>
<CheckBox checked={this.state.check1} onPress={() => this.changeCheck('check1')} />
<Body>
<Text>Daily Stand Up</Text>
</Body>
</ListItem>
<ListItem>
<CheckBox checked={this.state.check2} onPress={() => this.changeCheck('check2')} />
<Body>
<Text>Discussion with Client</Text>
</Body>
</ListItem>
<ListItem>
<CheckBox checked={this.state.check3} color="green" onPress={() => this.changeCheck('check3')} />
<Body>
<Text>Finish list Screen</Text>
</Body>
</ListItem>
</Content>
</Container>
);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment