UNPKG

@fruits-chain/react-native-xiaoshu

Version:
46 lines (44 loc) 1.09 kB
"use strict"; import React, { memo } from 'react'; import { View } from 'react-native'; import Theme from "../theme/index.js"; import { varCreator } from "./style.js"; import { jsx as _jsx } from "react/jsx-runtime"; const getGapValue = (v, initialValue) => { return typeof v === 'boolean' ? v ? initialValue : 0 : v; }; const Blank = ({ theme, left = true, right = true, top = false, bottom = false, size = 'm', type = 'margin', children, style, ...restProps }) => { const [CV] = Theme.useStyle({ varCreator, theme }); const defaultGap = CV[`blank_size_${size}`]; // 重置值 left = getGapValue(left, defaultGap); right = getGapValue(right, defaultGap); top = getGapValue(top, defaultGap); bottom = getGapValue(bottom, defaultGap); return /*#__PURE__*/_jsx(View, { ...restProps, style: [{ [`${type}Left`]: left, [`${type}Right`]: right, [`${type}Top`]: top, [`${type}Bottom`]: bottom }, style], children: children }); }; export default /*#__PURE__*/memo(Blank); //# sourceMappingURL=blank.js.map