File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,6 @@ class TimerWrapper extends Component {
2828 } = this . props ;
2929
3030 if ( active ) {
31- const progress = Math . max ( 0 , Math . min ( 1 , time / duration ) ) ;
32-
3331 onStart ( {
3432 duration,
3533 progress : this . getProgress ( time ) ,
@@ -49,7 +47,7 @@ class TimerWrapper extends Component {
4947 onStop,
5048 } = nextProps ;
5149
52- if ( active === this . props . active && time !== this . state . time ) {
50+ if ( active === this . props . active && time !== this . props . time && time !== this . state . time ) {
5351 const timeDiff = this . state . time - time ;
5452
5553 this . setState ( {
@@ -103,7 +101,7 @@ class TimerWrapper extends Component {
103101 } = this . state ;
104102
105103 if ( ! duration ) {
106- return null ;
104+ return 0 ;
107105 }
108106
109107 return Math . max ( 0 , Math . min ( 1 , time / duration ) ) ;
@@ -125,15 +123,15 @@ class TimerWrapper extends Component {
125123
126124 let nextTime = Date . now ( ) - startTime ;
127125
128- onTimeUpdate ( {
129- duration,
130- progress : this . getProgress ( nextTime ) ,
131- time : nextTime ,
132- } ) ;
133-
134126 this . setState ( {
135127 time : nextTime ,
136128 } , ( ) => {
129+ onTimeUpdate ( {
130+ duration,
131+ progress : this . getProgress ( nextTime ) ,
132+ time : nextTime ,
133+ } ) ;
134+
137135 if ( duration !== null && nextTime >= duration ) {
138136 onFinish ( {
139137 duration,
You can’t perform that action at this time.
0 commit comments