fix(js): allow setting stopColor/Opacity/Offset using styles, fix #1153

This commit is contained in:
Mikael Sand
2019-10-19 21:50:53 +03:00
parent 0c7e94d0cb
commit 5984e0629e
2 changed files with 6 additions and 5 deletions
-4
View File
@@ -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) {
+6 -1
View File
@@ -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);