UNPKG

@fruits-chain/react-native-xiaoshu

Version:
40 lines (34 loc) 1.48 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 { getDefaultValue } from '../helpers'; import CheckedFill from '../icon/checked.fill'; import CircleOutline from '../icon/circle'; import Theme from '../theme'; import { varCreator } from './style'; const CheckboxIcon = _ref => { let { active, activeColor, size, disabled, ...restProps } = _ref; const TOKENS = Theme.useThemeTokens(); const CV = Theme.createVar(TOKENS, varCreator); // 从配置中拿默认值 size = getDefaultValue(size, CV.checkbox_icon_size); activeColor = getDefaultValue(activeColor, CV.checkbox_checked_icon_color); if (active) { return /*#__PURE__*/React.createElement(CheckedFill, _extends({}, restProps, { size: size, color: disabled ? CV.checkbox_checked_icon_disabled_color : activeColor, disabled: disabled })); } return /*#__PURE__*/React.createElement(CircleOutline, _extends({}, restProps, { size: size, disabled: disabled, color: disabled ? CV.checkbox_icon_disabled_color : CV.checkbox_icon_color })); }; export default /*#__PURE__*/memo(CheckboxIcon); //# sourceMappingURL=checkbox-icon.js.map