Remove 'child.type === Stop' check from extractGradient

This commit is contained in:
Shane Fitzpatrick
2018-05-09 12:29:00 -07:00
parent 046c7efc04
commit e4754d2e9c
+7 -13
View File
@@ -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)
);
}
});