From e4754d2e9ce0c0c4ad9e19ea9777e3edb4b0c420 Mon Sep 17 00:00:00 2001 From: Shane Fitzpatrick Date: Wed, 9 May 2018 12:29:00 -0700 Subject: [PATCH] Remove 'child.type === Stop' check from extractGradient --- lib/extract/extractGradient.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/extract/extractGradient.js b/lib/extract/extractGradient.js index 141d4ff8..3c79e0f6 100644 --- a/lib/extract/extractGradient.js +++ b/lib/extract/extractGradient.js @@ -15,20 +15,14 @@ export default function(props) { const stops = {}; Children.forEach(props.children, child => { - if (child.type === Stop) { - if (child.props.stopColor && child.props.offset) { - // convert percent to float. - let offset = percentToFloat(child.props.offset); + if (child.props.stopColor && child.props.offset) { + // convert percent to float. + let offset = percentToFloat(child.props.offset); - // add stop - //noinspection JSUnresolvedFunction - stops[offset] = Color(child.props.stopColor).alpha( - extractOpacity(child.props.stopOpacity) - ); - } - } else { - console.warn( - "`Gradient` elements only accept `Stop` elements as children" + // add stop + //noinspection JSUnresolvedFunction + stops[offset] = Color(child.props.stopColor).alpha( + extractOpacity(child.props.stopOpacity) ); } });