Skip to content

Commit

Permalink
fix(js): allow setting stopColor/Opacity/Offset using styles, fix #1153
Browse files Browse the repository at this point in the history
  • Loading branch information
msand committed Oct 19, 2019
1 parent 0c7e94d commit 5984e06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/elements/Stop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion src/lib/extract/extractGradient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5984e06

Please sign in to comment.