diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-06-01 19:47:08 -0400 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-06-01 19:47:08 -0400 |
| commit | 3e72bfa56c860826429a842f6c128d78d4a930db (patch) | |
| tree | 3cecd31c92d53fae32e9761b80802c82f3dcb7fa /client/src/lib/components/checkbox.js | |
| parent | b694bd511ceccd00d4a4c98f36f910d5fc5f79c4 (diff) | |
react-native-web port of fmf app
Diffstat (limited to 'client/src/lib/components/checkbox.js')
| -rw-r--r-- | client/src/lib/components/checkbox.js | 35 |
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, + } +}) |
