UNPKG

react-native-inner-shadow

Version:

react native inner shadows with linear gradient design UI

90 lines (87 loc) 2.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LinearGradientComponent = LinearGradientComponent; exports.RadialGradientFill = RadialGradientFill; exports.default = LinearGradientFill; var _reactNativeSkia = require("@shopify/react-native-skia"); var _utils = require("../../utils.js"); var _react = _interopRequireDefault(require("react")); var _jsxRuntime = require("react/jsx-runtime"); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Internal helper component that draws the linear gradient. * You can rename this to "LinearGradientFill" or similar if you prefer. */function LinearGradientFill({ width = 0, height = 0, ...props }) { const isRadial = (0, _utils.isRadialProps)(props); if (isRadial) { return /*#__PURE__*/(0, _jsxRuntime.jsx)(RadialGradientFill, { width: width, height: height, ...props }); } return /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradientComponent, { width: width, height: height, ...props }); } /** * Internal helper component that draws the linear gradient. * You can rename this to "LinearGradientFill" or similar if you prefer. */ function LinearGradientComponent({ width = 0, height = 0, from = 'top', to = 'bottom', colors }) { const { start, end } = _react.default.useMemo(() => (0, _utils.getLinearDirection)({ width, height, from, to }), [width, height, from, to]); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSkia.LinearGradient, { start: start, end: end, colors: colors }); } /** * Internal helper component that draws the linear gradient. * You can rename this to "LinearGradientFill" or similar if you prefer. */ function RadialGradientFill({ width = 0, height = 0, colors, center, radius }) { const { c, r } = _react.default.useMemo(() => (0, _utils.getRadialDirection)({ width, height, center, radius }), [width, height, center, radius]); return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSkia.RadialGradient, { c: c, r: r, colors: colors }); } //# sourceMappingURL=ShadowLinearGradientFill.js.map