879479119 / react-native-shadow

A SVG shadow component powered with react-native-svg,which can provide shadow on Android like iOS ^_^

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid attempt to spread non-iterable instance

rawsly opened this issue · comments

Giving this error while using BorderShadow that is wrapping a View. Code:

<BorderShadow setting={feedShadow}> <View style={styles.feedContainer}> <Text>Test</Text> </View> </BorderShadow>

where 'feedShadow' is:
const feedShadow = { width: screenWidth - 40, color: COLORS.BLACK, border: 10, opacity: 0.1, side: 'top', inset: false };

The error points last line of this code:

return [ <Svg height={lineWidth} width={width+lineWidth} style={{position:"absolute",top:(inset?0:-lineWidth)}}> <Defs> <LinearGradient id="top" x1="0%" x2="0%" y1="100%" y2="0%">{linear('BorderTop')}</LinearGradient> <LinearGradient id="top-inset" x1="0%" x2="0%" y1="0%" y2="100%">{linear('BorderTopInset')}</LinearGradient> </Defs> <Rect x={0} y={0} width={width} height={lineWidth} fill={url(#top${inset?"-inset":""})} /> </Svg>, ...children ]

There is a temporary solution for this

<BorderShadow> {[ <YourComponent/> ]} </BorderShadow>

how to set the key to this array?