UNPKG

3.01 kBJavaScriptView Raw
1import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";import _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/TextPath.tsx";import React from'react';import{requireNativeComponent}from'react-native';import extractTransform from'../lib/extract/extractTransform';import{withoutXY}from'../lib/extract/extractProps';import extractText from'../lib/extract/extractText';import{idPattern,pickNotNil}from'../lib/util';import Shape from'./Shape';import TSpan from'./TSpan';var TextPath=function(_Shape){_inherits(TextPath,_Shape);function TextPath(){var _getPrototypeOf2;var _this;_classCallCheck(this,TextPath);for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}_this=_possibleConstructorReturn(this,(_getPrototypeOf2=_getPrototypeOf(TextPath)).call.apply(_getPrototypeOf2,[this].concat(args)));_this.setNativeProps=function(props){var matrix=!props.matrix&&extractTransform(props);if(matrix){props.matrix=matrix;}_extends(props,pickNotNil(extractText(props,true)));_this.root&&_this.root.setNativeProps(props);};return _this;}_createClass(TextPath,[{key:"render",value:function render(){var _this$props=this.props,children=_this$props.children,xlinkHref=_this$props.xlinkHref,_this$props$href=_this$props.href,href=_this$props$href===void 0?xlinkHref:_this$props$href,_this$props$startOffs=_this$props.startOffset,startOffset=_this$props$startOffs===void 0?0:_this$props$startOffs,method=_this$props.method,spacing=_this$props.spacing,side=_this$props.side,alignmentBaseline=_this$props.alignmentBaseline,midLine=_this$props.midLine,prop=_objectWithoutProperties(_this$props,["children","xlinkHref","href","startOffset","method","spacing","side","alignmentBaseline","midLine"]);var matched=href&&href.match(idPattern);var match=matched&&matched[1];if(match){var props=withoutXY(this,prop);_extends(props,extractText({children:children},true),{href:match,startOffset:startOffset,method:method,spacing:spacing,side:side,alignmentBaseline:alignmentBaseline,midLine:midLine});props.ref=this.refMethod;return React.createElement(RNSVGTextPath,_extends({},props,{__source:{fileName:_jsxFileName,lineNumber:74}}));}console.warn('Invalid `href` prop for `TextPath` element, expected a href like "#id", but got: "'+href+'"');return React.createElement(TSpan,{ref:this.refMethod,__source:{fileName:_jsxFileName,lineNumber:83}},children);}}]);return TextPath;}(Shape);TextPath.displayName='TextPath';export{TextPath as default};export var RNSVGTextPath=requireNativeComponent('RNSVGTextPath');
2//# sourceMappingURL=TextPath.js.map
\No newline at end of file