/* * @Author: mingwei * @Date: 2022-06-30 15:28:01 * @LastEditors: mingwei * @LastEditTime: 2022-07-01 09:11:17 * @FilePath: /react-native-dev-sdk/src/tools/utils/shadow/BorderShadow.tsx * @Description: */ import { Component } from 'react'; import { View } from 'react-native'; import Svg, { Rect, Defs, LinearGradient, Stop } from 'react-native-svg'; export type BorderSettingShadowType = { side: string | 'bottom'; width: number; color: string; border: number; opacity: number; inset: boolean; style: any; }; export class BorderShadow extends Component<{ setting: BorderSettingShadowType; children: any }> { render = () => { const { setting: { side = 'bottom', width = 0, color = '#000', border = 0, opacity = 1, inset = false, style = {}, }, children, } = this.props; const linear = key => { return [ , , ]; }; const lineWidth = border; return ( {(() => { switch (side) { case 'top': return [ {linear('BorderTop')} {linear('BorderTopInset')} , ...children, ]; case 'bottom': return [ ...children, {linear('BorderBottom')} {linear('BorderBottomInset')} , ]; default: throw new Error("Wrong Type of Side! We just support 'top' and 'bottom'"); } })()} ); }; }