@@ -29,47 +29,33 @@ import {
2929 TouchableNativeFeedback ,
3030 View
3131} from 'react-native'
32- import PropTypes from 'prop-types' ;
32+ const { OS } = Platform ;
3333
34- const OS = Platform . OS ;
34+ import PropTypes from 'prop-types' ;
3535
3636class TouchableEffect extends Component {
3737
3838 render ( ) {
39- const { onPress, children, style, background, delayPressIn } = this . props ;
40-
4139 let touchable ;
4240
4341 if ( OS === 'android' ) {
44- touchable = < TouchableNativeFeedback
45- style = { style }
46- onPress = { onPress }
47- delayPressIn = { delayPressIn }
48- background = { background } >
49- { children }
50- </ TouchableNativeFeedback >
42+ touchable = < TouchableNativeFeedback { ...this . props } />
5143 } else {
52- touchable = < TouchableOpacity
53- style = { style }
54- delayPressIn = { delayPressIn }
55- onPress = { onPress } >
56- { children }
57- </ TouchableOpacity >
44+ touchable = < TouchableOpacity { ...this . props } />
5845 }
5946
6047 return touchable ;
6148 }
6249}
6350
64- TouchableEffect . propTypes = {
65- onPress : TouchableOpacity . propTypes . onPress . isRequired ,
66- style : View . propTypes . style ,
67- delayPressIn : TouchableOpacity . propTypes . delayPressIn ,
68- background : OS === 'android' ? TouchableNativeFeedback . propTypes . background : PropTypes . any ,
51+ if ( OS === 'android' ) {
52+ TouchableEffect . propTypes = { ...TouchableNativeFeedback . propTypes } ;
53+ } else {
54+ TouchableEffect . propTypes = { ...TouchableOpacity . propTypes } ;
6955}
7056
7157TouchableEffect . defaultProps = {
72- background : OS === 'android' ? TouchableNativeFeedback . SelectableBackground ( ) : null
58+ background : OS === 'android' ? TouchableNativeFeedback . SelectableBackground ( ) : undefined
7359} ;
7460
7561export default TouchableEffect
0 commit comments