diff --git a/Circle.js b/Circle.js index 571746f..0889034 100644 --- a/Circle.js +++ b/Circle.js @@ -57,17 +57,10 @@ export class ProgressCircle extends Component { allowFontScaling: true, }; - constructor(props, context) { - super(props, context); - - this.progressValue = 0; - } - - componentWillMount() { + componentDidMount() { if (this.props.animated) { this.props.progress.addListener(event => { - this.progressValue = event.value; - if (this.props.showsText || this.progressValue === 1) { + if (this.props.showsText || event.value === 1) { this.forceUpdate(); } }); @@ -111,7 +104,8 @@ export class ProgressCircle extends Component { const Surface = rotation ? AnimatedSurface : ART.Surface; const Shape = animated ? AnimatedArc : Arc; - const progressValue = animated ? this.progressValue : progress; + // eslint-disable-next-line no-underscore-dangle + const progressValue = animated ? progress.__getValue() : progress; const angle = animated ? Animated.multiply(progress, CIRCLE) : progress * CIRCLE; @@ -204,9 +198,7 @@ export class ProgressCircle extends Component { {formatText(progressValue)} - ) : ( - false - )} + ) : false} {children} );