Skip to content

Commit 0e60a7c

Browse files
author
정인중 [N Studio]
committed
Runs the animation when the default progress is given
1 parent 9964c4b commit 0e60a7c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

withAnimation.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function withAnimation(WrappedComponent, indeterminateProgress) {
2424
constructor(props) {
2525
super(props);
2626

27-
this.progressValue = Math.min(Math.max(props.progress, 0), 1);
27+
this.progressValue = 0;
2828
this.rotationValue = 0;
2929
this.state = {
3030
progress: new Animated.Value(this.progressValue),
@@ -33,6 +33,7 @@ export default function withAnimation(WrappedComponent, indeterminateProgress) {
3333
}
3434

3535
componentDidMount() {
36+
this.updateProgress(this.props);
3637
this.state.progress.addListener(event => {
3738
this.progressValue = event.value;
3839
});
@@ -68,6 +69,10 @@ export default function withAnimation(WrappedComponent, indeterminateProgress) {
6869
});
6970
}
7071
}
72+
this.updateProgress(props)
73+
}
74+
75+
updateProgress(props) {
7176
const progress = props.indeterminate
7277
? indeterminateProgress || 0
7378
: Math.min(Math.max(props.progress, 0), 1);

0 commit comments

Comments
 (0)