mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-31 13:52:58 +00:00
fix(js): allow setting stopColor/Opacity/Offset using styles, fix #1153
This commit is contained in:
@@ -8,10 +8,6 @@ export default class Stop extends Component<StopProps, {}> {
|
||||
props!: StopProps;
|
||||
static displayName = 'Stop';
|
||||
|
||||
static defaultProps = {
|
||||
stopColor: '#000',
|
||||
stopOpacity: 1,
|
||||
};
|
||||
setNativeProps = () => {
|
||||
const { parent } = this.props;
|
||||
if (parent) {
|
||||
|
||||
@@ -63,7 +63,12 @@ export default function extractGradient(
|
||||
const l = childArray.length;
|
||||
for (let i = 0; i < l; i++) {
|
||||
const {
|
||||
props: { offset, stopColor, stopOpacity },
|
||||
props: {
|
||||
style,
|
||||
offset = style && style.offset,
|
||||
stopColor = (style && style.stopColor) || '#000',
|
||||
stopOpacity = style && style.stopOpacity,
|
||||
},
|
||||
} = childArray[i];
|
||||
const offsetNumber = percentToFloat(offset || 0);
|
||||
const color = stopColor && extractColor(stopColor);
|
||||
|
||||
Reference in New Issue
Block a user