UNPKG

react-native-web-ui-components

Version:

[![Dependencies](https://img.shields.io/badge/dependencies-renovate-brightgreen.svg)](https://github.com/CareLuLu/react-native-web-ui-components/issues/12) [![Codacy Badge](https://img.shields.io/codacy/grade/c0ef990240a84ab7abee7af64602dd6d/master)](http

38 lines (33 loc) 934 B
import React from 'react'; import PropTypes from 'prop-types'; import { TouchableOpacity as RNTouchableOpacity } from 'react-native'; import { withTheme } from '../Theme'; const TouchableOpacity = ({ theme, onRef, className, ...props }) => { const params = { ...theme.omit(props), dataSet: { class: className }, 'data-class': className, ref: undefined }; if (onRef) { params.ref = onRef; } return /*#__PURE__*/React.createElement(RNTouchableOpacity, params); }; TouchableOpacity.propTypes = { theme: PropTypes.shape().isRequired, className: PropTypes.string, onRef: PropTypes.func }; TouchableOpacity.defaultProps = { className: '', onRef: null }; const TouchableOpacityWithTheme = withTheme('TouchableOpacity')(TouchableOpacity); // eslint-disable-next-line export default React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(TouchableOpacityWithTheme, props));