@fruits-chain/react-native-xiaoshu
Version:
🌈 React Native UI library
39 lines (37 loc) • 1.13 kB
JavaScript
import isNil from 'lodash/isNil';
import React, { memo } from 'react';
import Locale from '../locale';
import Result from '../result';
import ResultIconEmpty from '../result/icons/result-icon-empty';
import Theme from '../theme';
import { varCreator, styleCreator } from './style';
/**
* Empty 空元素
* @description 用于填充空白数据。
*/
const Empty = _ref => {
let {
text,
style,
textStyle,
iconStyle,
icon,
full = false
} = _ref;
const locale = Locale.useLocale().Empty;
const TOKENS = Theme.useThemeTokens();
const CV = Theme.createVar(TOKENS, varCreator);
const STYLES = Theme.createStyle(CV, styleCreator);
const iconJSX = !isNil(icon) ? icon : /*#__PURE__*/React.createElement(ResultIconEmpty, {
style: [STYLES.icon, iconStyle]
});
return /*#__PURE__*/React.createElement(Result, {
status: "info",
renderIcon: () => iconJSX,
style: [STYLES.empty, full ? STYLES.emptyFull : null, style],
subtitle: text || locale.text,
subtitleTextStyle: [STYLES.text, textStyle]
});
};
export default /*#__PURE__*/memo(Empty);
//# sourceMappingURL=index.js.map