()
| 73 | } |
| 74 | |
| 75 | render() { |
| 76 | const { |
| 77 | children, |
| 78 | backgroundColor, |
| 79 | backgroundOpacity, |
| 80 | foregroundColor, |
| 81 | foregroundOpacity, |
| 82 | rtl, |
| 83 | style, |
| 84 | beforeMask, |
| 85 | ...props |
| 86 | } = this.props |
| 87 | |
| 88 | const x1Animation = this.animatedValue.interpolate({ |
| 89 | extrapolate: 'clamp', |
| 90 | inputRange: [-1, 2], |
| 91 | outputRange: ['-100%', '100%'], |
| 92 | }) |
| 93 | |
| 94 | const x2Animation = this.animatedValue.interpolate({ |
| 95 | extrapolate: 'clamp', |
| 96 | inputRange: [-1, 2], |
| 97 | outputRange: ['0%', '200%'], |
| 98 | }) |
| 99 | |
| 100 | const rtlStyle: object = rtl ? { transform: [{ rotateY: '180deg' }] } : {} |
| 101 | const svgStyle = Object.assign(Object.assign({}, style), rtlStyle) |
| 102 | |
| 103 | // Remove unnecessary keys |
| 104 | delete props.uniqueKey |
| 105 | delete props.animate |
| 106 | delete props.speed |
| 107 | |
| 108 | return ( |
| 109 | <Svg style={svgStyle} {...props}> |
| 110 | {beforeMask && isValidElement(beforeMask) ? beforeMask : null} |
| 111 | |
| 112 | <Rect |
| 113 | x="0" |
| 114 | y="0" |
| 115 | width="100%" |
| 116 | height="100%" |
| 117 | fill={`url(#${this.idClip})`} |
| 118 | clipPath={`url(#${this.idGradient})`} |
| 119 | /> |
| 120 | |
| 121 | <Defs> |
| 122 | <ClipPath id={this.idGradient}>{children}</ClipPath> |
| 123 | |
| 124 | <AnimatedLinearGradient |
| 125 | id={this.idClip} |
| 126 | x1={x1Animation} |
| 127 | x2={x2Animation} |
| 128 | y1={0} |
| 129 | y2={0} |
| 130 | > |
| 131 | <Stop offset={0} stopColor={backgroundColor} stopOpacity={backgroundOpacity} /> |
| 132 | <Stop offset={0.5} stopColor={foregroundColor} stopOpacity={foregroundOpacity} /> |
no outgoing calls
no test coverage detected