Merge pull request #227 from better-half/master

Add explicit useNativeDriver to AnimatedCircularProgress
This commit is contained in:
Markus Lindqvist 2020-01-16 10:25:51 +02:00 committed by GitHub
commit a3430d0570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Animated, AppState, Easing, View, ViewPropTypes } from 'react-native';
import { Animated, Easing } from 'react-native';
import CircularProgress from './CircularProgress';
const AnimatedProgress = Animated.createAnimatedComponent(CircularProgress);
@ -35,8 +35,10 @@ export default class AnimatedCircularProgress extends React.PureComponent {
const toValue = toVal >= 0 ? toVal : this.props.fill;
const duration = dur || this.props.duration;
const easing = ease || this.props.easing;
const useNativeDriver = this.props.useNativeDriver;
const anim = Animated.timing(this.state.fillAnimation, {
useNativeDriver,
toValue,
easing,
duration,
@ -72,10 +74,12 @@ AnimatedCircularProgress.propTypes = {
duration: PropTypes.number,
easing: PropTypes.func,
onAnimationComplete: PropTypes.func,
useNativeDriver: PropTypes.bool,
};
AnimatedCircularProgress.defaultProps = {
duration: 500,
easing: Easing.out(Easing.ease),
prefill: 0,
useNativeDriver: true,
};