Skip to content

Commit 97dc9c3

Browse files
committed
Fix height animation
1 parent 71f9ab4 commit 97dc9c3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/LineChart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class LineChart extends Component<void, any, any> {
2020

2121
constructor(props : any) {
2222
super(props);
23-
const heightValue = (props.animated) ? 0 : props.containerHeight;
23+
const heightValue = (props.animated) ? 0 : props.height;
2424
const opacityValue = (props.animated) ? 0 : 1;
2525
this.state = { height: new Animated.Value(heightValue), opacity: new Animated.Value(opacityValue) };
2626
}
@@ -34,7 +34,7 @@ export default class LineChart extends Component<void, any, any> {
3434

3535
componentDidUpdate() {
3636
if (this.props.animated) {
37-
Animated.timing(this.state.height, { duration: this.props.animationDuration, toValue: 1 }).start();
37+
Animated.timing(this.state.height, { duration: this.props.animationDuration, toValue: this.props.height }).start();
3838
Animated.timing(this.state.opacity, { duration: this.props.animationDuration, toValue: 1 }).start();
3939
}
4040
}
@@ -107,7 +107,7 @@ export default class LineChart extends Component<void, any, any> {
107107

108108
render() : any {
109109
return (
110-
<View>
110+
<View style={{ overflow: 'hidden' }}>
111111
<Grid {...this.props} />
112112
<Animated.View style={{ height: this.state.height, opacity: this.state.opacity, backgroundColor: 'transparent' }}>
113113
{this._drawLine()}

0 commit comments

Comments
 (0)