-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·59 lines (55 loc) · 1.48 KB
/
index.js
File metadata and controls
executable file
·59 lines (55 loc) · 1.48 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
const React = require('react');
const {
PropTypes,
} = React;
const ReactNative = require('react-native');
const {
StyleSheet,
Text,
TouchableOpacity,
View,
} = ReactNative;
const DEFAULT_OPACITY = 0.2;
module.exports = React.createClass({
propTypes: {
onPress: PropTypes.func,
disable: PropTypes.bool,
textStyle: Text.propTypes.style,
activeOpacity: PropTypes.number,
},
render () {
const touchableProps = {
activeOpacity: this.props.disable ? 1 : this.props.activeOpacity ? this.props.activeOpacity : DEFAULT_OPACITY,
};
if (!this.props.disable) {
touchableProps.onPress = this.props.onPress;
}
return (
<TouchableOpacity
style={this.props.style} {...touchableProps}
testID={this.props.testID}>
<Text style={[styles.text, this.props.disable ? styles.disableText : null, this.props.textStyle]}>
{this.props.children}
</Text>
</TouchableOpacity>
);
},
});
const styles = StyleSheet.create({
text: {
color: '#5890ff',
fontFamily: '.HelveticaNeueInterface-MediumP4',
fontSize: 18,
fontWeight: '100',
textAlign: 'center',
},
disableText: {
color: '#dcdcdc',
},
group: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
});