@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
42 lines (37 loc) • 1.35 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 { View } from 'react-native';
import Theme from '../theme';
import { varCreator } from './style';
const getGapValue = (v, initialValue) => {
return typeof v === 'boolean' ? v ? initialValue : 0 : v;
};
const Blank = _ref => {
let {
children,
size = 'm',
left = true,
right = true,
top = false,
bottom = false,
style,
...restProps
} = _ref;
const TOKENS = Theme.useThemeTokens();
const CV = Theme.createVar(TOKENS, varCreator);
const defaultGap = CV[`blank_size_${size}`]; // 重置值
left = getGapValue(left, defaultGap);
right = getGapValue(right, defaultGap);
top = getGapValue(top, defaultGap);
bottom = getGapValue(bottom, defaultGap);
return /*#__PURE__*/React.createElement(View, _extends({}, restProps, {
style: [{
marginLeft: left,
marginRight: right,
marginTop: top,
marginBottom: bottom
}, style]
}), children);
};
export default /*#__PURE__*/memo(Blank);
//# sourceMappingURL=index.js.map