oblador / react-native-progress

Progress indicators and spinners for React Native
MIT License
3.63k stars 516 forks source link

Progress updated by Animated.Value.interpolate #98

Open Culzean opened 6 years ago

Culzean commented 6 years ago

I have tried created a progress circle like this:

                <Progress.Circle 
                size={30}
                 indeterminate={false}
                 progress={this.state.fillAmount} />

where fillAmount is updated with interpolate,

this.state.fillAmount = this.state.spinValue.interpolate({
                inputRange: [0,1],
                outputRange: [0, 100]
            });

and spinValue is updated with Animated.timing,

            Animated.timing(
                this.state.spinValue,
            {
                toValue: 1,
                duration: 2000,
                easing: Easing.linear,

            }
            ).start();

However I get the error,

Error while updating property 'd' in shadow node of type: ARTShape
null

TypeError: expected dynamic type 'double', but had type 'null'

Is it possible to update the progress using my own Animated.timings? I understand the animated api is used under the hood. Is that correct?

Thanks.

jwh-hutchison commented 1 year ago

Is there a way to use our own Animated.timings? this would be useful for when we want to specify different durations between progress, I've tried with Progress.Pie but it's returning: Warning: Failed prop type: Invalid prop `progress` of type `object` supplied to `withAnimation(ProgressPie)`, expected `number`.