blob: ea4ab7e8467834bfa7cf3bcc66ab99f6ac6a242e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import React, { Component } from 'react'
import {
View,
Image,
StyleSheet,
} from 'react-native'
import ClearText from './text'
export default class CheckBox extends Component {
render() {
const image = this.props.checked ? (
<Image source={require('../../img/checkbox-on.png')} style={styles.image} />
) : (
<Image source={require('../../img/checkbox-off.png')} style={styles.image} />
)
return (
<View style={[styles.row, this.props.containerStyle]} onClick={() => this.props.onChange(this.props.checked)}>
{image}
<ClearText style={this.props.labelStyle}>{this.props.label}</ClearText>
</View>
)
}
}
const styles = StyleSheet.create({
row: {
flexDirection: 'row',
},
image: {
width: 30,
height: 30,
marginRight: 5,
}
})
|