UNPKG

@fruits-chain/react-native-xiaoshu

Version:
41 lines (38 loc) 1.14 kB
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 { View } from 'react-native'; import { useRow } from './context'; const BASE_SPAN_WIDTH = 100 / 24; /** * Col 布局 * @description 每个子单元格。 */ const Col = _ref => { let { style, span, offset = 0, ...restProps } = _ref; const { gap = 0 } = useRow(); const width = `${+span * BASE_SPAN_WIDTH}%`; const left = `${+offset * BASE_SPAN_WIDTH}%`; const colStyles = [{ flexGrow: 0, flexShrink: 0, flexBasis: width, paddingHorizontal: +gap / 2, marginLeft: left }, style // to test ui // { // backgroundColor: '#000', // }, ]; return /*#__PURE__*/React.createElement(View, _extends({}, restProps, { style: colStyles })); }; export default /*#__PURE__*/memo(Col); //# sourceMappingURL=col.js.map