-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (40 loc) · 1.11 KB
/
index.js
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
import React from 'react'
import { TouchableOpacity, Platform } from 'react-native'
import PropTypes from "prop-types"
import RippleTouchable from './lib/RippleTouchable'
const Touchable = props => (Platform.OS === 'android' || props.waves) ? (
// Android implements
<RippleTouchable
rippleSize={ props.size || 0 }
rippleColor={ props.hint || '#000' }
rippleOpacity={ props.alpha || 0.3 }
rippleOpacity={ props.alpha || 0.3 }
rippleDuration={ props.duration || 600 }
rippleContainerBorderRadius={
props.radius ||
(
props.style &&
props.style.borderRadius
) || 0
}
{ ...props }>
{ props.children }
</RippleTouchable>
) : (
// iOS implements
<TouchableOpacity activeOpacity={ 0.6 } { ...props }>
{ props.children }
</TouchableOpacity>
)
Touchable.propTypes = {
size: PropTypes.number,
hint: PropTypes.string,
alpha: PropTypes.number,
radius: PropTypes.number,
centered: PropTypes.bool,
duration: PropTypes.number,
onPress: PropTypes.func,
onPressIn: PropTypes.func,
onPressOut: PropTypes.func
}
export default Touchable