You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -264,6 +264,11 @@ toast('Hello World', {
264
264
text: TextStyle,
265
265
indicator: ViewStyle
266
266
},
267
+
animationType:'timing'|'spring',
268
+
animationConfig: {
269
+
flingPositionReturnDuration: number,
270
+
...(springConfig | timingConfig)
271
+
},
267
272
});
268
273
```
269
274
@@ -402,6 +407,63 @@ Every type has its own duration. You can overwrite them `duration` with the toas
402
407
403
408
<br />
404
409
410
+
### Animation Options
411
+
You can now control the animation type and configuration for toasts.
412
+
413
+
#### Props
414
+
415
+
-**animationType** (`'spring' | 'timing'`, optional): Choose the animation type for toast appearance. By default, toasts positioned at the bottom use spring, and those at the top use timing.
416
+
-**animationConfig** (object, optional): Customize the animation configuration for spring or timing.
417
+
418
+
#### Example Usage
419
+
420
+
```javascript
421
+
import { toast } from'react-native-toast';
422
+
423
+
// Show a toast with custom animation settings
424
+
toast.show('This is a toast message', {
425
+
animationType:'spring',
426
+
animationConfig: {
427
+
duration:500,
428
+
stiffness:100,
429
+
},
430
+
position:'top',
431
+
});
432
+
````
433
+
434
+
### Global Animation Configuration/Type
435
+
436
+
You can define a `globalAnimationType` and a `globalAnimationConfig` that sets the default animation configuration for all toasts. If an individual toast specifies its own `animationConfig`, it will override thisglobal setting.
437
+
438
+
#### Props
439
+
440
+
-**globalAnimationConfig** (object, optional): Provides a default configuration for toast animations using either spring or timing options.
0 commit comments