30 | render() { |
31 | const _a = this.props, { settings, children } = _a, others = __rest(_a, ["settings", "children"]); |
32 | const { width = 0, height = 0, color = "#000", border = 0, radius = 0, opacity = 1, x = 0, y = 0, } = settings; |
33 | const lineWidth = border, rectWidth = width - radius * 2, rectHeight = height - radius * 2; |
34 | const outerWidth = lineWidth + radius; |
35 | const middleOffset = radius / outerWidth; |
36 | return (React.createElement(react_native_1.View, Object.assign({}, others), |
37 | React.createElement(Svg, { height: height + lineWidth * 2 + radius * 2, width: width + lineWidth * 2 + radius * 2, style: { position: "absolute", top: y - lineWidth, left: x - lineWidth } }, |
38 | React.createElement(Defs, null, |
39 | React.createElement(LinearGradient, { id: "top", x1: "0", y1: `${lineWidth}`, x2: "0", y2: "0" }, this.linear('BoxTop', opacity, color)), |
40 | React.createElement(LinearGradient, { id: "bottom", x1: "0", y1: "0", x2: "0", y2: `${lineWidth}` }, this.linear('BoxBottom', opacity, color)), |
41 | React.createElement(LinearGradient, { id: "left", x1: `${lineWidth}`, y1: "0", x2: "0", y2: "0" }, this.linear('BoxLeft', opacity, color)), |
42 | React.createElement(LinearGradient, { id: "right", x1: "0", y1: "0", x2: `${lineWidth}`, y2: "0" }, this.linear('BoxRight', opacity, color)), |
43 | React.createElement(RadialGradient, { id: "border-left-top", r: outerWidth, cx: outerWidth, cy: outerWidth, fx: outerWidth, fy: outerWidth }, this.radial('BoxLeftTop', opacity, color, middleOffset)), |
44 | React.createElement(RadialGradient, { id: "border-left-bottom", r: outerWidth, cx: outerWidth, cy: 0, fx: outerWidth, fy: 0 }, this.radial('BoxLeftBottom', opacity, color, middleOffset)), |
45 | React.createElement(RadialGradient, { id: "border-right-top", r: outerWidth, cx: 0, cy: outerWidth, fx: 0, fy: outerWidth }, this.radial('BoxRightTop', opacity, color, middleOffset)), |
46 | React.createElement(RadialGradient, { id: "border-right-bottom", r: outerWidth, cx: 0, cy: 0, fx: 0, fy: 0 }, this.radial('BoxRightBottom', opacity, color, middleOffset))), |
47 | React.createElement(Path, { d: `M 0 ${outerWidth},Q 0 0 ${outerWidth} 0,v ${lineWidth},q ${-radius} 0 ${-radius} ${radius},h ${-lineWidth},z`, fill: "url(#border-left-top)" }), |
48 | React.createElement(Path, { d: `M ${rectWidth + lineWidth + radius} 0,q ${outerWidth} 0 ${outerWidth} ${outerWidth},h ${-lineWidth},q 0 ${-radius} ${-radius} ${-radius},v ${-lineWidth},z`, fill: "url(#border-right-top)" }), |
49 | React.createElement(Path, { d: `M ${rectWidth + lineWidth + 2 * radius} ${rectHeight + lineWidth + radius},h ${lineWidth},q 0 ${outerWidth} -${outerWidth} ${outerWidth},v ${-lineWidth},q ${radius} 0 ${radius} ${-radius},z`, fill: "url(#border-right-bottom)" }), |
50 | React.createElement(Path, { d: `M 0 ${rectHeight + lineWidth + radius},q 0 ${outerWidth} ${outerWidth} ${outerWidth},v ${-lineWidth},q ${-radius} 0 ${-radius} ${-radius},h ${-lineWidth},z`, fill: "url(#border-left-bottom)" }), |
51 | React.createElement(Rect, { x: outerWidth, y: "0", width: rectWidth, height: lineWidth, fill: "url(#top)" }), |
52 | React.createElement(Rect, { x: "0", y: outerWidth, width: lineWidth, height: rectHeight, fill: "url(#left)" }), |
53 | React.createElement(Rect, { x: rectWidth + lineWidth + 2 * radius, y: outerWidth, width: lineWidth, height: rectHeight, fill: "url(#right)" }), |
54 | React.createElement(Rect, { x: outerWidth, y: rectHeight + lineWidth + 2 * radius, width: rectWidth, height: lineWidth, fill: "url(#bottom)" }), |
55 | React.createElement(Path, { d: `M ${outerWidth} ${lineWidth},h ${rectWidth},q ${radius} 0 ${radius} ${radius},v ${rectHeight},q 0 ${radius} -${radius} ${radius},h -${rectWidth},q -${radius} 0 -${radius} -${radius},v -${rectHeight},q 0 -${radius} ${radius} -${radius}`, fill: alpha(color, opacity) })), |
56 | children)); |
57 | } |