react-native-shadow icon indicating copy to clipboard operation
react-native-shadow copied to clipboard

Invalid attempt to spread non-iterable instance

Open rawsly opened this issue 5 years ago • 2 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 ]

rawsly avatar Jan 15 '20 19:01 rawsly

There is a temporary solution for this

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

Jamyth avatar Feb 03 '20 16:02 Jamyth

how to set the key to this array?

changyu2hao avatar May 27 '20 18:05 changyu2hao