mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-08 09:10:44 +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;
|
props!: StopProps;
|
||||||
static displayName = 'Stop';
|
static displayName = 'Stop';
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
stopColor: '#000',
|
|
||||||
stopOpacity: 1,
|
|
||||||
};
|
|
||||||
setNativeProps = () => {
|
setNativeProps = () => {
|
||||||
const { parent } = this.props;
|
const { parent } = this.props;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
|||||||
@@ -63,7 +63,12 @@ export default function extractGradient(
|
|||||||
const l = childArray.length;
|
const l = childArray.length;
|
||||||
for (let i = 0; i < l; i++) {
|
for (let i = 0; i < l; i++) {
|
||||||
const {
|
const {
|
||||||
props: { offset, stopColor, stopOpacity },
|
props: {
|
||||||
|
style,
|
||||||
|
offset = style && style.offset,
|
||||||
|
stopColor = (style && style.stopColor) || '#000',
|
||||||
|
stopOpacity = style && style.stopOpacity,
|
||||||
|
},
|
||||||
} = childArray[i];
|
} = childArray[i];
|
||||||
const offsetNumber = percentToFloat(offset || 0);
|
const offsetNumber = percentToFloat(offset || 0);
|
||||||
const color = stopColor && extractColor(stopColor);
|
const color = stopColor && extractColor(stopColor);
|
||||||
|
|||||||
Reference in New Issue
Block a user