@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
39 lines (38 loc) • 904 B
JavaScript
import isNil from 'lodash/isNil';
import React, { memo } from 'react';
import { Text } from 'react-native';
import Theme from "../theme/index.js";
import { useDropdownConfig } from "./context.js";
import { varCreator, styleCreator } from "./style.js";
import { jsx as _jsx } from "react/jsx-runtime";
const DropdownBadge = ({
count,
style,
...restProps
}) => {
const {
theme
} = useDropdownConfig();
const [, STYLES] = Theme.useStyle({
varCreator,
styleCreator,
theme
});
if (isNil(count)) {
return null;
}
if (count === true) {
return /*#__PURE__*/_jsx(Text, {
...restProps,
style: [STYLES.badge_dot, style]
});
}
return /*#__PURE__*/_jsx(Text, {
...restProps,
style: [STYLES.badge_text, style],
children: count
});
};
export default /*#__PURE__*/memo(DropdownBadge);
//# sourceMappingURL=dropdown-badge.js.map
;