From da7db43db1e6c555dbaf03116b56ae48a6c3b638 Mon Sep 17 00:00:00 2001 From: ahanriat Date: Thu, 24 Aug 2017 17:47:06 +0200 Subject: [PATCH] Add Animated.loop typings --- types/react-native/index.d.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 10652f02fc..6346297446 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -8194,6 +8194,10 @@ export namespace Animated { friction?: number; } + interface LoopAnimationConfig { + iterations?: number; // default -1 for infinite + } + /** * Creates a new Animated value composed from two Animated values added * together. @@ -8275,6 +8279,18 @@ export namespace Animated { animations: Array ): CompositeAnimation + /** + * Loops a given animation continuously, so that each time it reaches the end, + * it resets and begins again from the start. Can specify number of times to + * loop using the key 'iterations' in the config. Will loop without blocking + * the UI thread if the child animation is set to 'useNativeDriver'. + */ + + export function loop( + animation: CompositeAnimation, + config?: LoopAnimationConfig, + ): CompositeAnimation + /** * Spring animation based on Rebound and Origami. Tracks velocity state to * create fluid motions as the `toValue` updates, and can be chained together.