forked from calebnance/expo-spotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTouchIcon.js
More file actions
36 lines (31 loc) · 812 Bytes
/
TouchIcon.js
File metadata and controls
36 lines (31 loc) · 812 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
import React from 'react';
import { TouchableOpacity } from 'react-native';
import PropTypes from 'prop-types';
import { gStyle } from '../api';
const TouchIcon = ({ icon, iconSize, onPress, style }) => (
<TouchableOpacity
activeOpacity={gStyle.activeOpacity}
onPress={onPress}
hitSlop={{ bottom: 5, left: 5, right: 5, top: 5 }}
style={[gStyle.flexCenter, style]}
>
{React.cloneElement(icon, { size: iconSize })}
</TouchableOpacity>
);
TouchIcon.defaultProps = {
iconSize: 24,
style: {}
};
TouchIcon.propTypes = {
// required
icon: PropTypes.element.isRequired,
onPress: PropTypes.func.isRequired,
// optional
iconSize: PropTypes.number,
style: PropTypes.oneOfType([
PropTypes.array,
PropTypes.number,
PropTypes.object
])
};
export default TouchIcon;