forked from calebnance/expo-spotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTouchText.js
More file actions
40 lines (35 loc) · 889 Bytes
/
TouchText.js
File metadata and controls
40 lines (35 loc) · 889 Bytes
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
import React from 'react';
import { Text, TouchableOpacity } from 'react-native';
import PropTypes from 'prop-types';
import { gStyle } from '../api';
const TouchText = ({ onPress, style, styleText, text }) => (
<TouchableOpacity
activeOpacity={gStyle.activeOpacity}
hitSlop={{ top: 10, left: 10, bottom: 10, right: 10 }}
onPress={onPress}
style={[gStyle.flexCenter, style]}
>
<Text style={styleText}>{text}</Text>
</TouchableOpacity>
);
TouchText.defaultProps = {
style: {},
styleText: {}
};
TouchText.propTypes = {
// required
text: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired,
// optional
style: PropTypes.oneOfType([
PropTypes.array,
PropTypes.number,
PropTypes.object
]),
styleText: PropTypes.oneOfType([
PropTypes.array,
PropTypes.number,
PropTypes.object
])
};
export default TouchText;