From 3e72bfa56c860826429a842f6c128d78d4a930db Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 1 Jun 2017 19:47:08 -0400 Subject: react-native-web port of fmf app --- client/src/lib/components/button.js | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 client/src/lib/components/button.js (limited to 'client/src/lib/components/button.js') 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 ( + { if (! this.props.disabled) { this.props.onPress() }}}> + + + {this.props.label} + + + + ) + } +} + +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', + }, +}) -- cgit v1.2.3-70-g09d2