UNPKG

react-native-svg

Version:
2 lines 2.6 kB
import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";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/jannegylling/IdeaProjects/react-native-svg/src/elements/Use.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(source,true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(source).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React from'react';import{requireNativeComponent}from'react-native';import extractProps,{propsAndStyles}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},extractProps(_objectSpread({},propsAndStyles(props),{x:null,y:null}),this),{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'); //# sourceMappingURL=Use.js.map