Warning - Method `repeat` is deprecated. Please use `withRepeat` instead
See original GitHub issueDescription
I’m following the example to use the withRepeat
hook, but getting a warning.
Screenshots
Steps To Reproduce
Code below
Expected behavior
Animation runs as expected, and repeats indefinitely. No crashes.
Actual behavior
Warning when animation starts. Crash when animation finishes.
Snack or minimal code example
const ANGLE = 2;
const DURATION = 120;
const EASING = Easing.inOut(Easing.ease);
const AnimatedSmartGridTile = (props: SmartGridTileProps) => {
const smartGridContext = useSmartGridContext();
const editing = smartGridContext.editing;
const rotation = useSharedValue(0);
rotation.value = editing.value
? withSequence(
// deviate left to start from -ANGLE
withTiming(-ANGLE, {duration: DURATION / 2, easing: EASING}),
// wobble between -ANGLE and ANGLE 7 times
withRepeat(
withTiming(ANGLE, {
duration: DURATION,
easing: EASING,
}),
-1,
true,
),
// go back to 0 at the end
withTiming(0, {duration: DURATION / 2, easing: EASING}),
)
: 0;
const animatedStyle = useAnimatedStyle(() => ({
transform: [{rotateZ: `${rotation.value}deg`}],
}));
return (
<Animated.View style={animatedStyle}>
<SmartGridTile {...props} />
</Animated.View>
);
};
Package versions
- React: 16.13.1
- React Native: 0.63.3
- React Native Reanimated: 2.0.0-alpha.8
- NodeJS: 12.18.4
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
withRepeat | React Native Reanimated - Software Mansion
This function will be called when all repetitions of the provided animation are complete or when withRepeat is cancelled. In case the animation...
Read more >Using UIViewPropertyAnimator with repeat and autoreverse ...
Is there any possible way to autoreverse and repeat a property animation without having to use deprecated code? Please do not suggest to...
Read more >Intermediate R for Finance - RPubs
Repeat, repeat, repeat. Loops are a core concept in programming. They are used in almost every language. In R, there is another way...
Read more >Intermediate to R for Finance - Amazon AWS
POSIXct is a way to represent datetime objects like “2015-01-22 08:39:40 EST”, meaning that ... Argument ohlc_fun is deprecated; please use select instead....
Read more >Frequently Asked Questions about Pardot - Salesforce Help
An error reading 'WARNING: Your Salesforce Connector user does not have all ... to repeat rule' counted in the automation rule with 'Repeat...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m actually using
withRepeat
- code snippet below:Crash is not happening - it was not related to this issue.
Ok, thanks for information. Good luck!