summaryrefslogtreecommitdiff
path: root/client/src/lib/components/checkbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/lib/components/checkbox.js')
-rw-r--r--client/src/lib/components/checkbox.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/client/src/lib/components/checkbox.js b/client/src/lib/components/checkbox.js
new file mode 100644
index 0000000..ea4ab7e
--- /dev/null
+++ b/client/src/lib/components/checkbox.js
@@ -0,0 +1,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,
+ }
+})