UNPKG

react-native-svg

Version:
2 lines 3.04 kB
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _react=_interopRequireDefault(require("react"));var _extractProps=require("../lib/extract/extractProps");var _util=require("../lib/util");var _Shape2=_interopRequireDefault(require("./Shape"));var _NativeComponents=require("./NativeComponents");var _jsxFileName="/Users/wojciechlewicki/work/deeper/react-native-svg/src/elements/Use.tsx";function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=(0,_getPrototypeOf2.default)(Derived),result;if(hasNativeReflectConstruct){var NewTarget=(0,_getPrototypeOf2.default)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return(0,_possibleConstructorReturn2.default)(this,result);};}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}var Use=function(_Shape){(0,_inherits2.default)(Use,_Shape);var _super=_createSuper(Use);function Use(){(0,_classCallCheck2.default)(this,Use);return _super.apply(this,arguments);}(0,_createClass2.default)(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(_util.idPattern);var match=matched&&matched[1];if(!match){console.warn('Invalid `href` prop for `Use` element, expected a href like "#id", but got: "'+href+'"');}var useProps={href:match,x:x,y:y,width:width,height:height};return _react.default.createElement(_NativeComponents.RNSVGUse,(0,_extends2.default)({ref:this.refMethod},(0,_extractProps.withoutXY)(this,props),useProps,{__self:this,__source:{fileName:_jsxFileName,lineNumber:59,columnNumber:7}}),children);}}]);return Use;}(_Shape2.default);exports.default=Use;(0,_defineProperty2.default)(Use,"displayName",'Use');(0,_defineProperty2.default)(Use,"defaultProps",{x:0,y:0,width:0,height:0}); //# sourceMappingURL=Use.js.map