121 lines
4.8 KiB
React
121 lines
4.8 KiB
React
// Metro module 4612 (f4613).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _possibleConstructorReturn from "./_possibleConstructorReturn";
|
|
import _getPrototypeOf from "./_getPrototypeOf";
|
|
import _inherits from "./_inherits";
|
|
import { Component, createRef } from "react";
|
|
import { StyleSheet, processColor, View } from "react-native";
|
|
import Module4613 from "./Module4613";
|
|
let _excluded, convertPoint;
|
|
let LinearGradient;
|
|
let env2811 = {};
|
|
env2811[14] = function _isNativeReflectConstruct() {
|
|
let c14360_0;
|
|
try {
|
|
c14360_0 = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
} catch ($e) {}
|
|
const _isNativeReflectConstruct2 = function _isNativeReflectConstruct() {
|
|
return !!c14360_0;
|
|
};
|
|
env2811[14] = _isNativeReflectConstruct2;
|
|
return _isNativeReflectConstruct2();
|
|
};
|
|
_excluded = ["children", "colors", "end", "locations", "useAngle", "angleCenter", "angle", "start", "style"];
|
|
convertPoint = (a0, a1) => {};
|
|
LinearGradient = function LinearGradient(...args) {
|
|
_classCallCheck(this, LinearGradient);
|
|
const r10 = [...args];
|
|
const r9 = _getPrototypeOf(LinearGradient);
|
|
const r26 = _possibleConstructorReturn(this, (0, env2811[14])() ? Reflect.construct(r9, r10, _getPrototypeOf(this).constructor) : r9.apply(this, r10));
|
|
r26.gradientRef = (0, createRef)();
|
|
return r26;
|
|
};
|
|
_inherits(LinearGradient, Component);
|
|
const r51 = _createClass(LinearGradient, [{
|
|
key: "setNativeProps",
|
|
value: function setNativeProps(a0) {
|
|
this.gradientRef.current.setNativeProps(a0);
|
|
}
|
|
}, {
|
|
key: "render",
|
|
value: function render() {
|
|
const props = this.props;
|
|
const { children, colors, end, locations, useAngle, angleCenter, angle, start, style, ...rest } = props;
|
|
if ((colors ? locations : colors) && colors.length !== locations.length) {
|
|
console.warn("LinearGradient colors and locations props should be arrays of the same length");
|
|
}
|
|
const r39 = StyleSheet.flatten(style) || {};
|
|
let r40 = r39.borderRadius || 0;
|
|
const borderTopLeftRadius = r39.borderTopLeftRadius;
|
|
const borderRadii = [typeof borderTopLeftRadius === "number" ? borderTopLeftRadius : r40, , , , , , , ,];
|
|
const borderTopLeftRadius2 = r39.borderTopLeftRadius;
|
|
borderRadii[1] = typeof borderTopLeftRadius2 === "number" ? borderTopLeftRadius2 : r40;
|
|
const borderTopRightRadius = r39.borderTopRightRadius;
|
|
borderRadii[2] = typeof borderTopRightRadius === "number" ? borderTopRightRadius : r40;
|
|
const borderTopRightRadius2 = r39.borderTopRightRadius;
|
|
borderRadii[3] = typeof borderTopRightRadius2 === "number" ? borderTopRightRadius2 : r40;
|
|
const borderBottomRightRadius = r39.borderBottomRightRadius;
|
|
borderRadii[4] = typeof borderBottomRightRadius === "number" ? borderBottomRightRadius : r40;
|
|
const borderBottomRightRadius2 = r39.borderBottomRightRadius;
|
|
borderRadii[5] = typeof borderBottomRightRadius2 === "number" ? borderBottomRightRadius2 : r40;
|
|
const borderBottomLeftRadius = r39.borderBottomLeftRadius;
|
|
borderRadii[6] = typeof borderBottomLeftRadius === "number" ? borderBottomLeftRadius : r40;
|
|
const borderBottomLeftRadius2 = r39.borderBottomLeftRadius;
|
|
if (typeof borderBottomLeftRadius2 === "number") {
|
|
r40 = borderBottomLeftRadius2;
|
|
}
|
|
borderRadii[7] = r40;
|
|
const colors2 = global.RN$Bridgeless ? colors : colors.map(processColor);
|
|
const isArray = Array.isArray(start);
|
|
let startPoint = start;
|
|
if (isArray) {
|
|
console.warn(`LinearGradient 'start' property should be an object with fields 'x' and 'y', Array type is deprecated.`);
|
|
startPoint = {
|
|
x: start[0],
|
|
y: start[1]
|
|
};
|
|
}
|
|
const isArray2 = Array.isArray(end);
|
|
let endPoint = end;
|
|
if (isArray2) {
|
|
console.warn(`LinearGradient 'end' property should be an object with fields 'x' and 'y', Array type is deprecated.`);
|
|
endPoint = {
|
|
x: end[0],
|
|
y: end[1]
|
|
};
|
|
}
|
|
const locations2 = locations ? locations.slice(0, colors.length) : null;
|
|
const isArray3 = Array.isArray(angleCenter);
|
|
let angleCenter2 = angleCenter;
|
|
if (isArray3) {
|
|
console.warn(`LinearGradient 'angleCenter' property should be an object with fields 'x' and 'y', Array type is deprecated.`);
|
|
angleCenter2 = {
|
|
x: angleCenter[0],
|
|
y: angleCenter[1]
|
|
};
|
|
}
|
|
return <View ref={this.gradientRef} {...rest} style={style}>
|
|
<Module4613 style={{
|
|
position: "absolute",
|
|
top: 0,
|
|
left: 0,
|
|
bottom: 0,
|
|
right: 0
|
|
}} colors={colors2} startPoint={startPoint} endPoint={endPoint} locations={locations2} useAngle={useAngle} angleCenter={angleCenter2} angle={angle} borderRadii={borderRadii} />
|
|
{children}
|
|
</View>;
|
|
}
|
|
}]);
|
|
r51.defaultProps = {
|
|
start: {
|
|
x: 0.5,
|
|
y: 0
|
|
},
|
|
end: {
|
|
x: 0.5,
|
|
y: 1
|
|
}
|
|
};
|
|
export default r51;
|