Skip to content

Commit

Permalink
More code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacse committed Mar 13, 2019
1 parent 327cce9 commit 07f332c
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions src/AnimatedCircularProgress.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
import React from 'react';
import PropTypes from 'prop-types';
import {
Animated,
AppState,
Easing,
View,
ViewPropTypes
} from 'react-native';
import { Animated, AppState, Easing, View, ViewPropTypes } from 'react-native';
import CircularProgress from './CircularProgress';
const AnimatedProgress = Animated.createAnimatedComponent(CircularProgress);

export default class AnimatedCircularProgress extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
fillAnimation: new Animated.Value(props.prefill)
}
fillAnimation: new Animated.Value(props.prefill),
};
}

componentDidMount() {
Expand All @@ -29,9 +23,12 @@ export default class AnimatedCircularProgress extends React.PureComponent {
}

reAnimate(prefill, toVal, dur, ease) {
this.setState({
fillAnimation: new Animated.Value(prefill)
}, () => this.animate(toVal, dur, ease));
this.setState(
{
fillAnimation: new Animated.Value(prefill),
},
() => this.animate(toVal, dur, ease)
);
}

animate(toVal, dur, ease) {
Expand All @@ -52,12 +49,7 @@ export default class AnimatedCircularProgress extends React.PureComponent {
render() {
const { fill, prefill, ...other } = this.props;

return (
<AnimatedProgress
{...other}
fill={this.state.fillAnimation}
/>
);
return <AnimatedProgress {...other} fill={this.state.fillAnimation} />;
}
}

Expand Down

0 comments on commit 07f332c

Please sign in to comment.