mirror of
https://github.com/bartgryszko/react-native-circular-progress.git
synced 2026-01-18 16:13:10 +00:00
Merge pull request #20 from marcshilling/patch-1
Add performLinearAnimation function
This commit is contained in:
commit
f7cbd4243d
11
README.md
11
README.md
@ -48,6 +48,17 @@ You can also define a function, that'll receive current progress and for example
|
||||
</AnimatedCircularProgress>
|
||||
```
|
||||
|
||||
Finally, you can manually trigger a duration-based timing animation by putting a ref on the component and calling the `performLinearAnimation(toValue, duration)` function like so:
|
||||
```jsx
|
||||
<AnimatedCircularProgress
|
||||
ref='circularProgress'
|
||||
...
|
||||
/>
|
||||
```
|
||||
```javascript
|
||||
this.refs.circularProgress.performLinearAnimation(100, 8000); // Will fill the progress bar linearly in 8 seconds
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
You can configure the passing by following props:
|
||||
|
||||
@ -33,6 +33,13 @@ export default class AnimatedCircularProgress extends React.Component {
|
||||
}
|
||||
).start();
|
||||
}
|
||||
|
||||
performLinearAnimation(toValue, duration) {
|
||||
Animated.timing(this.state.chartFillAnimation, {
|
||||
toValue: toValue,
|
||||
duration: duration
|
||||
}).start();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { fill, prefill, ...other } = this.props;
|
||||
@ -49,7 +56,7 @@ export default class AnimatedCircularProgress extends React.Component {
|
||||
AnimatedCircularProgress.propTypes = {
|
||||
style: View.propTypes.style,
|
||||
size: PropTypes.number.isRequired,
|
||||
fill: PropTypes.number.isRequired,
|
||||
fill: PropTypes.number,
|
||||
prefill: PropTypes.number,
|
||||
width: PropTypes.number.isRequired,
|
||||
tintColor: PropTypes.string,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user