mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-27 04:32:57 +00:00
Handle color parsing when alpha = 1 (#512)
The `color` library doesn't include alpha when accessing `color.rgb().array()` when the alpha value is 1. Since we always use the alpha value, make it default to 1 when parsing a color.
This commit is contained in:
@@ -36,11 +36,11 @@ export default function(props) {
|
||||
const gradient = [];
|
||||
|
||||
sorted.forEach(({stop}) => {
|
||||
let channels = stop.rgbaArray();
|
||||
gradient.push(channels[0] / 255);
|
||||
gradient.push(channels[1] / 255);
|
||||
gradient.push(channels[2] / 255);
|
||||
gradient.push(channels[3]);
|
||||
let [r, g, b, a = 1] = stop.rgb().array();
|
||||
gradient.push(r / 255);
|
||||
gradient.push(g / 255);
|
||||
gradient.push(b / 255);
|
||||
gradient.push(a);
|
||||
});
|
||||
|
||||
gradient.push(...sorted.map(({offset}) => +offset));
|
||||
|
||||
Reference in New Issue
Block a user