mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 06:50:19 +00:00
Merge pull request #28732 from iyegoroff/react-native
react-native: fixed Animated.EventConfig
This commit is contained in:
Vendored
+3
-3
@@ -8465,8 +8465,8 @@ export namespace Animated {
|
||||
export function parallel(animations: Array<CompositeAnimation>, config?: ParallelConfig): CompositeAnimation;
|
||||
|
||||
type Mapping = { [key: string]: Mapping } | AnimatedValue;
|
||||
interface EventConfig {
|
||||
listener?: ValueListenerCallback;
|
||||
interface EventConfig<T> {
|
||||
listener?: (event?: NativeSyntheticEvent<T>) => void;
|
||||
useNativeDriver?: boolean;
|
||||
}
|
||||
|
||||
@@ -8486,7 +8486,7 @@ export namespace Animated {
|
||||
* ]),
|
||||
*```
|
||||
*/
|
||||
export function event(argMapping: Array<Mapping | null>, config?: EventConfig): (...args: any[]) => void;
|
||||
export function event<T>(argMapping: Array<Mapping | null>, config?: EventConfig<T>): (...args: any[]) => void;
|
||||
|
||||
/**
|
||||
* Make any React component Animatable. Used to create `Animated.View`, etc.
|
||||
|
||||
@@ -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
|
||||
@@ -63,6 +63,17 @@ function TestAnimatedAPI() {
|
||||
|
||||
Animated.stagger(100, [spring1, springXY]);
|
||||
|
||||
const listener = (e?: NativeSyntheticEvent<NativeScrollEvent>) => {
|
||||
if (e) {
|
||||
console.warn(e.nativeEvent.contentOffset.y);
|
||||
}
|
||||
};
|
||||
|
||||
Animated.event(
|
||||
[{ nativeEvent: { contentOffset: { y: v1 } } }],
|
||||
{ useNativeDriver: true, listener },
|
||||
);
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Animated.View
|
||||
|
||||
Reference in New Issue
Block a user