@fruits-chain/react-native-xiaoshu
Version:
React Native UI library
39 lines (37 loc) • 809 B
JavaScript
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 {
children,
style,
span,
offset = 0
} = _ref;
const {
gutter = 0
} = useRow();
const width = `${+span * BASE_SPAN_WIDTH}%`;
const left = `${+offset * BASE_SPAN_WIDTH}%`;
const colStyles = [{
flexGrow: 0,
flexShrink: 0,
flexBasis: width,
paddingHorizontal: +gutter / 2,
marginLeft: left
}, style // to test ui
// {
// backgroundColor: '#000',
// },
];
return /*#__PURE__*/React.createElement(View, {
style: colStyles
}, children);
};
export default /*#__PURE__*/memo(Col);
//# sourceMappingURL=col.js.map