@fruits-chain/react-native-xiaoshu
Version:
React Native UI library
29 lines (24 loc) • 1.06 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React, { memo } from 'react';
import { TouchableWithoutFeedback, View } from 'react-native';
const FlexItem = props => {
const {
style,
children,
flex = 1,
...restProps
} = props;
const flexItemStyle = {
flex
};
const inner = /*#__PURE__*/React.createElement(View, _extends({
style: [flexItemStyle, style]
}, restProps), children);
const shouldWrapInTouchableComponent = restProps.onPress || restProps.onLongPress || restProps.onPressIn || restProps.onPressOut;
if (shouldWrapInTouchableComponent) {
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, restProps, inner);
}
return inner;
};
export default /*#__PURE__*/memo(FlexItem);
//# sourceMappingURL=flex-item.js.map