From 4e5b1485d63fc672db755db7df5a6b6fca12a493 Mon Sep 17 00:00:00 2001 From: iyegoroff Date: Sat, 8 Sep 2018 18:24:12 +0300 Subject: [PATCH] added Animated.event test --- types/react-native/test/animated.tsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/types/react-native/test/animated.tsx b/types/react-native/test/animated.tsx index c27af04bb9..dab64d9d78 100644 --- a/types/react-native/test/animated.tsx +++ b/types/react-native/test/animated.tsx @@ -1,6 +1,6 @@ -import * as React from "react-native"; +import * as React from "react"; -import { Animated, View } from "react-native"; +import { Animated, View, NativeSyntheticEvent, NativeScrollEvent } from "react-native"; function TestAnimatedAPI() { // Value @@ -62,6 +62,17 @@ function TestAnimatedAPI() { Animated.sequence([spring1, springXY]); Animated.stagger(100, [spring1, springXY]); + + const listener = (e?: NativeSyntheticEvent) => { + if (e) { + console.warn(e.nativeEvent.contentOffset.y); + } + }; + + Animated.event( + [{ nativeEvent: { contentOffset: { y: v1 } } }], + { useNativeDriver: true, listener }, + ); return (