Skip to content

Commit 5b937cf

Browse files
committed
fix(toast): entering exiting animation type
1 parent 99ee150 commit 5b937cf

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

src/components/accordion/accordion.types.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type {
22
AnimatedProps,
33
BaseAnimationBuilder,
4-
EntryExitAnimationFunction,
4+
EntryOrExitLayoutType,
55
LayoutAnimationFunction,
66
WithSpringConfig,
77
WithTimingConfig,
@@ -149,17 +149,11 @@ export interface AccordionContentProps extends PrimitiveContentProps {
149149
/**
150150
* Custom entering animation for content
151151
*/
152-
entering?:
153-
| BaseAnimationBuilder
154-
| typeof BaseAnimationBuilder
155-
| EntryExitAnimationFunction;
152+
entering?: EntryOrExitLayoutType;
156153
/**
157154
* Custom exiting animation for content
158155
*/
159-
exiting?:
160-
| BaseAnimationBuilder
161-
| typeof BaseAnimationBuilder
162-
| EntryExitAnimationFunction;
156+
exiting?: EntryOrExitLayoutType;
163157
}
164158

165159
/**

src/components/toast/toast.animation.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,7 @@ import {
1515
getStyleProperties,
1616
getStyleTransform,
1717
} from '../../helpers/utils/animation';
18-
import type {
19-
ToastEnteringExitingAnimation,
20-
ToastPlacement,
21-
ToastRootAnimation,
22-
} from './toast.types';
18+
import type { ToastPlacement, ToastRootAnimation } from './toast.types';
2319

2420
// --------------------------------------------------
2521

@@ -82,26 +78,26 @@ export function useToastRootAnimation(options: {
8278
const enteringTopValue = getAnimationValueProperty({
8379
animationValue: animationConfig?.entering,
8480
property: 'top',
85-
defaultValue: enteringTop as ToastEnteringExitingAnimation,
81+
defaultValue: enteringTop,
8682
});
8783

8884
const enteringBottomValue = getAnimationValueProperty({
8985
animationValue: animationConfig?.entering,
9086
property: 'bottom',
91-
defaultValue: enteringBottom as ToastEnteringExitingAnimation,
87+
defaultValue: enteringBottom,
9288
});
9389

9490
// Exiting animation
9591
const exitingTopValue = getAnimationValueProperty({
9692
animationValue: animationConfig?.exiting,
9793
property: 'top',
98-
defaultValue: exitingTop as ToastEnteringExitingAnimation,
94+
defaultValue: exitingTop,
9995
});
10096

10197
const exitingBottomValue = getAnimationValueProperty({
10298
animationValue: animationConfig?.exiting,
10399
property: 'bottom',
104-
defaultValue: exitingBottom as ToastEnteringExitingAnimation,
100+
defaultValue: exitingBottom,
105101
});
106102

107103
// Opacity animation

src/components/toast/toast.types.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type {
2-
BaseAnimationBuilder,
3-
EntryExitAnimationFunction,
2+
EntryOrExitLayoutType,
43
WithTimingConfig,
54
} from 'react-native-reanimated';
65
import type { ViewRef } from '../../helpers/types';
@@ -24,14 +23,6 @@ export type ToastVariant =
2423
*/
2524
export type ToastPlacement = 'top' | 'bottom';
2625

27-
/**
28-
* Type for entering/exiting animation configurations
29-
*/
30-
export type ToastEnteringExitingAnimation =
31-
| BaseAnimationBuilder
32-
| typeof BaseAnimationBuilder
33-
| EntryExitAnimationFunction;
34-
3526
/**
3627
* Animation configuration for toast root component
3728
*/
@@ -77,24 +68,24 @@ export type ToastRootAnimation = Animation<{
7768
* Custom entering animation for top placement
7869
* @default FadeInUp.springify().withInitialValues({ opacity: 1, transform: [{ translateY: -100 }] }).mass(3)
7970
*/
80-
top?: ToastEnteringExitingAnimation;
71+
top?: EntryOrExitLayoutType;
8172
/**
8273
* Custom entering animation for bottom placement
8374
* @default FadeInDown.springify().withInitialValues({ opacity: 1, transform: [{ translateY: 100 }] }).mass(3)
8475
*/
85-
bottom?: ToastEnteringExitingAnimation;
76+
bottom?: EntryOrExitLayoutType;
8677
}>;
8778
exiting?: AnimationValue<{
8879
/**
8980
* Custom exiting animation for top placement
9081
* @default Keyframe animation with translateY: -100, scale: 0.97, opacity: 0.5
9182
*/
92-
top?: ToastEnteringExitingAnimation;
83+
top?: EntryOrExitLayoutType;
9384
/**
9485
* Custom exiting animation for bottom placement
9586
* @default Keyframe animation with translateY: 100, scale: 0.97, opacity: 0.5
9687
*/
97-
bottom?: ToastEnteringExitingAnimation;
88+
bottom?: EntryOrExitLayoutType;
9889
}>;
9990
}>;
10091

0 commit comments

Comments
 (0)