Skip to content

Commit 58f7e3d

Browse files
fix(line_geometries): use opacity for spring animation
1 parent f7f8d93 commit 58f7e3d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/components/react_canvas/line_geometries.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface LineGeometriesDataState {
2929
export class LineGeometries extends React.PureComponent<
3030
LineGeometriesDataProps,
3131
LineGeometriesDataState
32-
> {
32+
> {
3333
static defaultProps: Partial<LineGeometriesDataProps> = {
3434
animated: false,
3535
};
@@ -41,6 +41,7 @@ export class LineGeometries extends React.PureComponent<
4141
overPoint: undefined,
4242
};
4343
}
44+
4445
render() {
4546
return (
4647
<Group ref={this.barSeriesRef} key={'bar_series'}>
@@ -153,11 +154,12 @@ export class LineGeometries extends React.PureComponent<
153154
if (this.props.animated) {
154155
return (
155156
<Group key={i} x={transform.x}>
156-
<Spring native from={{ line }} to={{ line }}>
157-
{(props: { line: string }) => (
157+
<Spring native reset from={{ opacity: 0 }} to={{ opacity: 1 }}>
158+
{(props: { opacity: number }) => (
158159
<animated.Path
160+
opacity={props.opacity}
159161
key="line"
160-
data={props.line}
162+
data={line}
161163
strokeWidth={strokeWidth}
162164
stroke={color}
163165
listening={false}
@@ -172,7 +174,7 @@ export class LineGeometries extends React.PureComponent<
172174
} else {
173175
return (
174176
<Path
175-
key="line"
177+
key={i}
176178
data={line}
177179
strokeWidth={strokeWidth}
178180
stroke={color}

0 commit comments

Comments
 (0)