@audira/carbon-react-native
Version:
Build React Native apps with component and shared patterns using Carbon
41 lines (39 loc) • 2.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Icon = void 0;
var _react = require("react");
var IconHelper = _interopRequireWildcard(require("@carbon/icon-helpers"));
var _reactNativeSvg = require("react-native-svg");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
* Icon component is intentionally written in the form of React Class Component to support `Animated.createAnimatedComponent` API from React Native Reanimated
*/
class Icon extends _react.Component {
render() {
try {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.SvgXml, {
...this.props,
xml: IconHelper.toString(this.props.src),
width: this.props.width || '100%',
height: this.props.height || '100%'
});
} catch {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSvg.SvgXml, {
...this.props,
xml: backupIcon,
width: this.props.width || '100%',
height: this.props.height || '100%'
});
}
}
}
/**
* Copied from
* https://github.com/carbon-design-system/carbon-react-native/blob/main/src/helpers/index.tsx
*/
exports.Icon = Icon;
const backupIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 13.17 13.69"><line x1="0.71" y1="0.97" x2="12.46" y2="12.72" fill="currentColor" stroke="currentColor" stroke-miterlimit="10" stroke-width="2"/><line x1="1.02" y1="13.02" x2="12.15" y2="0.67" fill="currentColor" stroke="currentColor" stroke-miterlimit="10" stroke-width="2"/></svg>';
//# sourceMappingURL=Icon.js.map