@gluestack-ui/core
Version:
Universal UI components for React Native, Expo, and Next.js
48 lines • 2 kB
JSX
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import React from 'react';
import { Svg } from 'react-native-svg';
import { createIcon } from '../createIcon';
export { Svg };
export const PrimitiveIcon = React.forwardRef((_a, ref) => {
var { height, width, fill, color, classNameColor, size, stroke = 'currentColor', as: AsComp, style } = _a, props = __rest(_a, ["height", "width", "fill", "color", "classNameColor", "size", "stroke", "as", "style"]);
color = color !== null && color !== void 0 ? color : classNameColor;
const sizeProps = React.useMemo(() => {
if (size)
return { size };
if (height && width)
return { height, width };
if (height)
return { height };
if (width)
return { width };
return {};
}, [size, height, width]);
let colorProps = {};
if (fill) {
colorProps = Object.assign(Object.assign({}, colorProps), { fill: fill });
}
if (stroke !== 'currentColor') {
colorProps = Object.assign(Object.assign({}, colorProps), { stroke: stroke });
}
else if (stroke === 'currentColor' && color !== undefined) {
colorProps = Object.assign(Object.assign({}, colorProps), { stroke: color });
}
if (AsComp) {
return (<AsComp ref={ref} {...props} style={style} {...sizeProps} {...colorProps}/>);
}
return (<Svg ref={ref} height={height} width={width} {...colorProps} {...props}/>);
});
export const UIIcon = createIcon({
Root: PrimitiveIcon,
});
//# sourceMappingURL=index.jsx.map