Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix useAnimatedSensor return type #3094

Merged
merged 3 commits into from Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 15 additions & 3 deletions react-native-reanimated.d.ts
Expand Up @@ -498,10 +498,17 @@ declare module 'react-native-reanimated' {
interval: number;
};

export type AnimatedSensor = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason it's using a type rather than an interface?

sensor: SensorValue3D | SensorValueRotation | null;
unregister: () => void;
isAvailable: boolean;
config: SensorConfig;
};

export function useAnimatedSensor(
sensorType: SensorType,
userConfig?: SensorConfig
);
): AnimatedSensor;

export interface ExitAnimationsValues {
currentOriginX: number;
Expand Down Expand Up @@ -614,14 +621,19 @@ declare module 'react-native-reanimated' {
callback?: AnimationCallback
): number;
export function cancelAnimation<T>(sharedValue: SharedValue<T>): void;
export function withDelay<T extends AnimatableValue>(delayMS: number, delayedAnimation: T): T;
export function withDelay<T extends AnimatableValue>(
delayMS: number,
delayedAnimation: T
): T;
export function withRepeat<T extends AnimatableValue>(
animation: T,
numberOfReps?: number,
reverse?: boolean,
callback?: AnimationCallback
): T;
export function withSequence<T extends AnimatableValue>(...animations: [T, ...T[]]): T;
export function withSequence<T extends AnimatableValue>(
...animations: [T, ...T[]]
): T;

// reanimated2 functions
export function runOnUI<A extends any[], R>(
Expand Down
4 changes: 1 addition & 3 deletions src/reanimated2/hook/useAnimatedSensor.ts
Expand Up @@ -19,9 +19,7 @@ export type AnimatedSensor = {
sensor: SensorValue3D | SensorValueRotation | null;
unregister: () => void;
isAvailable: boolean;
config: {
interval: number;
};
config: SensorConfig;
};

export function useAnimatedSensor(
Expand Down