UNPKG

@fruits-chain/react-native-xiaoshu

Version:
42 lines (40 loc) 841 B
"use strict"; import React, { memo } from 'react'; import { View } from 'react-native'; import { useRow } from "./context.js"; import { jsx as _jsx } from "react/jsx-runtime"; const BASE_SPAN_WIDTH = 100 / 24; /** * Col 布局 * @description 每个子单元格。 */ const Col = ({ style, span, offset = 0, ...restProps }) => { 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__*/_jsx(View, { ...restProps, style: colStyles }); }; export default /*#__PURE__*/memo(Col); //# sourceMappingURL=col.js.map