import * as React from 'react'; import { Text, View, ViewStyle } from 'react-native'; import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg'; export interface IMDBorderShadowProps { side?: 'bottom' | 'top'; width?: number; color?: string; border?: number; opacity?: number; inset?: boolean; style?: ViewStyle; } export default class MDBorderShadow extends React.PureComponent< IMDBorderShadowProps > { public static defaultProps = { side: 'bottom', width: 0, color: '#000', border: 0, opacity: 1, inset: false, }; public render () { const { width, style, children } = this.props; return ( {this.renderShadow(children)} ); } private linear (key: string) { const { color, opacity } = this.props; const element1 = ( ); const element2 = ( ); return [element1, element2]; } private renderShadow (children?: React.ReactNode) { const { width, inset, border, side } = this.props; const lineWidth = border!; if (side === 'top') { return ( {this.linear('BorderTop')} {this.linear('BorderTopInset')} {typeof children === 'string' ? children : children} ); } else if (side === 'bottom') { return ( {typeof children === 'string' ? children : children} {this.linear('BorderBottom')} {this.linear('BorderBottomInset')} ); } else { throw new Error('Wrong Type of Side! We just support \'top\' and \'bottom\''); } } }