From 2d1718130a1273065ff8ddb2190eef5c7ea29421 Mon Sep 17 00:00:00 2001 From: Ajay Kumar <38132295+ajaykumar97@users.noreply.github.com> Date: Tue, 26 Nov 2019 10:35:44 +0530 Subject: [PATCH 1/2] Added old "BorderShadow.js" Added old "BorderShadow.js" file created by the author --- lib/BorderShadow.old.js | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/BorderShadow.old.js diff --git a/lib/BorderShadow.old.js b/lib/BorderShadow.old.js new file mode 100644 index 0000000..fe9baf8 --- /dev/null +++ b/lib/BorderShadow.old.js @@ -0,0 +1,53 @@ +import React, {Component} from 'react' +import {View} from 'react-native' +import Svg,{ Rect,Defs,LinearGradient,Stop,RadialGradient,Path } from 'react-native-svg' + +export default class BorderShadow extends Component { + 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'") + return null + } + })()} + + ) + } +} From 1683408542695f13fd286ba58afde1070d5f532b Mon Sep 17 00:00:00 2001 From: Ajay Kumar <38132295+ajaykumar97@users.noreply.github.com> Date: Tue, 26 Nov 2019 10:37:40 +0530 Subject: [PATCH 2/2] Bug Fix! Fixed "invalid attempt to spread non-iterable instance" --- lib/BorderShadow.js | 103 ++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/lib/BorderShadow.js b/lib/BorderShadow.js index fe9baf8..eca19b2 100644 --- a/lib/BorderShadow.js +++ b/lib/BorderShadow.js @@ -3,51 +3,68 @@ import {View} from 'react-native' import Svg,{ Rect,Defs,LinearGradient,Stop,RadialGradient,Path } from 'react-native-svg' export default class BorderShadow extends Component { - render = () => { + render = () => { - const { setting:{side="bottom",width=0,color="#000",border=0,opacity=1,inset=false,style={}}, children } = this.props + const { setting:{side="bottom",width=0,color="#000",border=0,opacity=1,inset=false,style={}}, children } = this.props - const linear = (key) => { - return [ - , - - ] - } + const linear = (key) => { + return [ + , + + ] + } - const lineWidth = border + 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'") - return null - } - })()} - - ) - } + 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'") + return null + } + })()} + {/* {children} */} + + ) + } }