2019-12-04 16:39:53 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
2021-05-04 18:02:01 +00:00
|
|
|
import { Pressable } from 'react-native';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { themes } from '../constants/colors';
|
|
|
|
|
|
|
|
class Touch extends React.Component {
|
|
|
|
setNativeProps(props) {
|
|
|
|
this.ref.setNativeProps(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
getRef = (ref) => {
|
|
|
|
this.ref = ref;
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2021-05-05 12:20:48 +00:00
|
|
|
children, onPress, onLongPress, theme, style, ...props
|
2019-12-04 16:39:53 +00:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
2021-05-04 18:02:01 +00:00
|
|
|
<Pressable
|
2019-12-04 16:39:53 +00:00
|
|
|
ref={this.getRef}
|
|
|
|
onPress={onPress}
|
2021-04-30 17:09:10 +00:00
|
|
|
onLongPress={onLongPress}
|
2019-12-04 16:39:53 +00:00
|
|
|
activeOpacity={1}
|
2021-05-05 12:20:48 +00:00
|
|
|
style={style}
|
2021-05-04 18:02:01 +00:00
|
|
|
android_ripple={{ color: themes[theme].bannerBackground }}
|
2019-12-04 16:39:53 +00:00
|
|
|
{...props}
|
|
|
|
>
|
|
|
|
{children}
|
2021-05-04 18:02:01 +00:00
|
|
|
</Pressable>
|
2019-12-04 16:39:53 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Touch.propTypes = {
|
|
|
|
children: PropTypes.node,
|
|
|
|
onPress: PropTypes.func,
|
2021-04-30 17:09:10 +00:00
|
|
|
onLongPress: PropTypes.func,
|
2021-01-21 19:52:26 +00:00
|
|
|
theme: PropTypes.string,
|
2021-05-05 12:20:48 +00:00
|
|
|
underlayColor: PropTypes.string,
|
|
|
|
style: PropTypes.object
|
2019-12-04 16:39:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Touch;
|