UNPKG

1.68 kBJavaScriptView Raw
1import _extends from"@babel/runtime/helpers/extends";import _classCallCheck from"@babel/runtime/helpers/classCallCheck";import _createClass from"@babel/runtime/helpers/createClass";import _possibleConstructorReturn from"@babel/runtime/helpers/possibleConstructorReturn";import _getPrototypeOf from"@babel/runtime/helpers/getPrototypeOf";import _inherits from"@babel/runtime/helpers/inherits";var _jsxFileName="/Users/msand/WebstormProjects/react-native-svg/src/elements/Use.tsx";import React from'react';import{requireNativeComponent}from'react-native';import{withoutXY}from'../lib/extract/extractProps';import{idPattern}from'../lib/util';import Shape from'./Shape';var Use=function(_Shape){_inherits(Use,_Shape);function Use(){_classCallCheck(this,Use);return _possibleConstructorReturn(this,_getPrototypeOf(Use).apply(this,arguments));}_createClass(Use,[{key:"render",value:function render(){var props=this.props;var children=props.children,x=props.x,y=props.y,width=props.width,height=props.height,xlinkHref=props.xlinkHref,_props$href=props.href,href=_props$href===void 0?xlinkHref:_props$href;var matched=href&&href.match(idPattern);var match=matched&&matched[1];if(!match){console.warn('Invalid `href` prop for `Use` element, expected a href like "#id", but got: "'+href+'"');}return React.createElement(RNSVGUse,_extends({ref:this.refMethod},withoutXY(this,props),{href:match,x:x,y:y,width:width,height:height,__source:{fileName:_jsxFileName,lineNumber:49}}),children);}}]);return Use;}(Shape);Use.displayName='Use';Use.defaultProps={x:0,y:0,width:0,height:0};export{Use as default};export var RNSVGUse=requireNativeComponent('RNSVGUse');
2//# sourceMappingURL=Use.js.map
\No newline at end of file