mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-27 04:32:57 +00:00
Remove 'child.type === Stop' check from extractGradient
This commit is contained in:
@@ -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)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user