diff options
| author | jules <jules@carbonpictures.com> | 2017-06-02 15:42:34 +0000 |
|---|---|---|
| committer | jules <jules@carbonpictures.com> | 2017-06-02 15:42:34 +0000 |
| commit | 5f26431f03228a85273e7f7d51abd6098ea9f2a5 (patch) | |
| tree | 6a709972cbb0babd68aaa10fe277b2c843fd7451 /client/src/lib/components/button.js | |
| parent | 291fe3eedd9a460fc44d2ea3ea81c7d79f2dfbcf (diff) | |
| parent | dd70fa81a205304cb48bbc0494ad34c16d496ff2 (diff) | |
merge
Diffstat (limited to 'client/src/lib/components/button.js')
| -rw-r--r-- | client/src/lib/components/button.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/client/src/lib/components/button.js b/client/src/lib/components/button.js new file mode 100644 index 0000000..a5cf8ea --- /dev/null +++ b/client/src/lib/components/button.js @@ -0,0 +1,55 @@ +import React, { Component } from 'react'; +import { + StyleSheet, + Text, + TouchableOpacity, + View +} from 'react-native'; +import DeviceInfo from 'react-native-device-info' + +export default class Button extends Component { + render() { + let { buttonStyle, textStyle, ...others } = this.props + let activeOpacity = 0.5 + let viewElementStyle = [ styles.button, buttonStyle ] + let textElementStyle = [ styles.text, textStyle ] + if (this.props.disabled) { + viewElementStyle.push( styles.disabledButton ) + textElementStyle.push( styles.disabledText ) + activeOpacity = 1.0 + } + return ( + <TouchableOpacity {...others} onPress={() => { if (! this.props.disabled) { this.props.onPress() }}}> + <View style={viewElementStyle}> + <Text style={textElementStyle}> + {this.props.label} + </Text> + </View> + </TouchableOpacity> + ) + } +} + +const styles = StyleSheet.create({ + text: { + color: '#000', + fontFamily: 'Futura-Medium', + textAlign: 'center', + padding: 0, + }, + button: { + padding: 10, + margin: 10, + borderRadius: 3, + backgroundColor: '#fff', + borderBottomColor: '#bbb', + borderBottomWidth: 2, + }, + disabledButton: { + backgroundColor: '#bbb', + borderBottomColor: '#888', + }, + disabledText: { + color: '#333', + }, +}) |
