react-native-puff-pop 1.0.6 â 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +331 -1
- package/lib/module/index.js +411 -69
- package/lib/typescript/src/index.d.ts +198 -3
- package/package.json +1 -1
- package/src/index.tsx +759 -77
package/README.md
CHANGED
|
@@ -15,7 +15,13 @@ Works with both **React Native CLI** and **Expo** projects - no native dependenc
|
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
|
-
- ðŽ **
|
|
18
|
+
- ðŽ **16 Animation Effects**: scale, rotate, fade, slideUp/Down/Left/Right, bounce, flip, zoom, rotateScale, shake, pulse, swing, wobble, elastic
|
|
19
|
+
- ðŊ **Exit Animations**: Different effects for enter and exit animations
|
|
20
|
+
- ð **Reverse Mode**: Reverse animation direction with a single prop
|
|
21
|
+
- ðïļ **Custom Initial Values**: Fine-tune starting opacity, scale, rotation, and position
|
|
22
|
+
- ð **Animation Intensity**: Control how dramatic your animations are (0-1)
|
|
23
|
+
- ð **Anchor Point**: Set transform origin for scale/rotate (top, bottom, corners, etc.)
|
|
24
|
+
- ð§ē **Spring Physics**: Use physics-based spring animations with customizable tension/friction
|
|
19
25
|
- ðĶī **Skeleton Mode**: Reserve space before animation or expand from zero height
|
|
20
26
|
- ⥠**Native Driver Support**: Smooth 60fps animations
|
|
21
27
|
- ðŊ **Easy to Use**: Just wrap your components with `<PuffPop>`
|
|
@@ -181,6 +187,295 @@ function App() {
|
|
|
181
187
|
</PuffPop>
|
|
182
188
|
```
|
|
183
189
|
|
|
190
|
+
### Exit Animation
|
|
191
|
+
|
|
192
|
+
Use different effects for enter and exit animations:
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
// Scale in, fade out
|
|
196
|
+
<PuffPop
|
|
197
|
+
effect="scale"
|
|
198
|
+
exitEffect="fade"
|
|
199
|
+
visible={isVisible}
|
|
200
|
+
>
|
|
201
|
+
<Modal />
|
|
202
|
+
</PuffPop>
|
|
203
|
+
|
|
204
|
+
// Slide up to enter, slide down to exit
|
|
205
|
+
<PuffPop
|
|
206
|
+
effect="slideUp"
|
|
207
|
+
exitEffect="slideDown"
|
|
208
|
+
exitDuration={200}
|
|
209
|
+
visible={isVisible}
|
|
210
|
+
>
|
|
211
|
+
<Toast />
|
|
212
|
+
</PuffPop>
|
|
213
|
+
|
|
214
|
+
// Different timing for enter and exit
|
|
215
|
+
<PuffPop
|
|
216
|
+
effect="zoom"
|
|
217
|
+
duration={400}
|
|
218
|
+
easing="spring"
|
|
219
|
+
exitEffect="fade"
|
|
220
|
+
exitDuration={150}
|
|
221
|
+
exitEasing="easeIn"
|
|
222
|
+
exitDelay={50}
|
|
223
|
+
visible={isVisible}
|
|
224
|
+
>
|
|
225
|
+
<Notification />
|
|
226
|
+
</PuffPop>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
With `PuffPopGroup`:
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
<PuffPopGroup
|
|
233
|
+
effect="slideUp"
|
|
234
|
+
exitEffect="fade"
|
|
235
|
+
exitDuration={150}
|
|
236
|
+
staggerDelay={50}
|
|
237
|
+
visible={isVisible}
|
|
238
|
+
>
|
|
239
|
+
<ListItem />
|
|
240
|
+
<ListItem />
|
|
241
|
+
<ListItem />
|
|
242
|
+
</PuffPopGroup>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Exit Stagger Animation
|
|
246
|
+
|
|
247
|
+
Stagger the exit animation of group children:
|
|
248
|
+
|
|
249
|
+
```tsx
|
|
250
|
+
// Children exit one by one in reverse order (last first)
|
|
251
|
+
<PuffPopGroup
|
|
252
|
+
staggerDelay={50}
|
|
253
|
+
exitStaggerDelay={50}
|
|
254
|
+
exitStaggerDirection="reverse"
|
|
255
|
+
visible={isVisible}
|
|
256
|
+
>
|
|
257
|
+
<ListItem />
|
|
258
|
+
<ListItem />
|
|
259
|
+
<ListItem />
|
|
260
|
+
</PuffPopGroup>
|
|
261
|
+
|
|
262
|
+
// Children exit from center outward
|
|
263
|
+
<PuffPopGroup
|
|
264
|
+
exitStaggerDelay={30}
|
|
265
|
+
exitStaggerDirection="center"
|
|
266
|
+
visible={isVisible}
|
|
267
|
+
>
|
|
268
|
+
<MenuItem />
|
|
269
|
+
<MenuItem />
|
|
270
|
+
<MenuItem />
|
|
271
|
+
<MenuItem />
|
|
272
|
+
<MenuItem />
|
|
273
|
+
</PuffPopGroup>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Exit stagger directions:
|
|
277
|
+
- `forward`: First child exits first
|
|
278
|
+
- `reverse`: Last child exits first (default, LIFO)
|
|
279
|
+
- `center`: Center children exit first
|
|
280
|
+
- `edges`: Edge children exit first
|
|
281
|
+
|
|
282
|
+
### Custom Initial Values
|
|
283
|
+
|
|
284
|
+
Fine-tune the starting values of your animations:
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
// Start from 50% opacity instead of 0
|
|
288
|
+
<PuffPop initialOpacity={0.5}>
|
|
289
|
+
<Card />
|
|
290
|
+
</PuffPop>
|
|
291
|
+
|
|
292
|
+
// Start from a larger scale
|
|
293
|
+
<PuffPop effect="scale" initialScale={0.5}>
|
|
294
|
+
<Avatar />
|
|
295
|
+
</PuffPop>
|
|
296
|
+
|
|
297
|
+
// Custom slide distance
|
|
298
|
+
<PuffPop effect="slideUp" initialTranslateY={200}>
|
|
299
|
+
<Modal />
|
|
300
|
+
</PuffPop>
|
|
301
|
+
|
|
302
|
+
// Combine multiple custom values
|
|
303
|
+
<PuffPop
|
|
304
|
+
effect="rotateScale"
|
|
305
|
+
initialOpacity={0.3}
|
|
306
|
+
initialScale={0.2}
|
|
307
|
+
initialRotate={-90}
|
|
308
|
+
>
|
|
309
|
+
<Icon />
|
|
310
|
+
</PuffPop>
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Reverse Mode
|
|
314
|
+
|
|
315
|
+
Reverse the animation direction:
|
|
316
|
+
|
|
317
|
+
```tsx
|
|
318
|
+
// slideUp now slides from top instead of bottom
|
|
319
|
+
<PuffPop effect="slideUp" reverse>
|
|
320
|
+
<Toast />
|
|
321
|
+
</PuffPop>
|
|
322
|
+
|
|
323
|
+
// slideLeft now slides from left instead of right
|
|
324
|
+
<PuffPop effect="slideLeft" reverse>
|
|
325
|
+
<Drawer />
|
|
326
|
+
</PuffPop>
|
|
327
|
+
|
|
328
|
+
// rotate spins clockwise instead of counter-clockwise
|
|
329
|
+
<PuffPop effect="rotate" reverse>
|
|
330
|
+
<Spinner />
|
|
331
|
+
</PuffPop>
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
With `PuffPopGroup`:
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
<PuffPopGroup effect="slideRight" reverse staggerDelay={50}>
|
|
338
|
+
<MenuItem />
|
|
339
|
+
<MenuItem />
|
|
340
|
+
<MenuItem />
|
|
341
|
+
</PuffPopGroup>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Animation Intensity
|
|
345
|
+
|
|
346
|
+
Control how dramatic your animations are with the `intensity` prop (0-1):
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
// Full animation (default)
|
|
350
|
+
<PuffPop effect="slideUp" intensity={1}>
|
|
351
|
+
<Card />
|
|
352
|
+
</PuffPop>
|
|
353
|
+
|
|
354
|
+
// Half the movement distance (25px instead of 50px)
|
|
355
|
+
<PuffPop effect="slideUp" intensity={0.5}>
|
|
356
|
+
<Card />
|
|
357
|
+
</PuffPop>
|
|
358
|
+
|
|
359
|
+
// Subtle animation (10px slide)
|
|
360
|
+
<PuffPop effect="slideUp" intensity={0.2}>
|
|
361
|
+
<Tooltip />
|
|
362
|
+
</PuffPop>
|
|
363
|
+
|
|
364
|
+
// No movement, just fade (intensity 0)
|
|
365
|
+
<PuffPop effect="slideUp" intensity={0}>
|
|
366
|
+
<Content />
|
|
367
|
+
</PuffPop>
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Works with all effects:
|
|
371
|
+
|
|
372
|
+
```tsx
|
|
373
|
+
// Smaller scale range (starts at 0.5 instead of 0)
|
|
374
|
+
<PuffPop effect="scale" intensity={0.5}>
|
|
375
|
+
<Avatar />
|
|
376
|
+
</PuffPop>
|
|
377
|
+
|
|
378
|
+
// Less rotation (180deg instead of 360deg)
|
|
379
|
+
<PuffPop effect="rotate" intensity={0.5}>
|
|
380
|
+
<Icon />
|
|
381
|
+
</PuffPop>
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
With `PuffPopGroup`:
|
|
385
|
+
|
|
386
|
+
```tsx
|
|
387
|
+
<PuffPopGroup effect="slideLeft" intensity={0.3} staggerDelay={50}>
|
|
388
|
+
<ListItem />
|
|
389
|
+
<ListItem />
|
|
390
|
+
<ListItem />
|
|
391
|
+
</PuffPopGroup>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Anchor Point
|
|
395
|
+
|
|
396
|
+
Set the transform origin for scale/rotate animations:
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
// Scale from top (expands downward)
|
|
400
|
+
<PuffPop effect="scale" anchorPoint="top">
|
|
401
|
+
<DropdownMenu />
|
|
402
|
+
</PuffPop>
|
|
403
|
+
|
|
404
|
+
// Scale from bottom-left corner
|
|
405
|
+
<PuffPop effect="scale" anchorPoint="bottomLeft">
|
|
406
|
+
<Tooltip />
|
|
407
|
+
</PuffPop>
|
|
408
|
+
|
|
409
|
+
// Rotate from top-left (door-opening effect)
|
|
410
|
+
<PuffPop effect="rotate" anchorPoint="topLeft">
|
|
411
|
+
<Panel />
|
|
412
|
+
</PuffPop>
|
|
413
|
+
|
|
414
|
+
// Flip from right edge
|
|
415
|
+
<PuffPop effect="flip" anchorPoint="right">
|
|
416
|
+
<Card />
|
|
417
|
+
</PuffPop>
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Available anchor points:
|
|
421
|
+
|
|
422
|
+
| Value | Description |
|
|
423
|
+
|-------|-------------|
|
|
424
|
+
| `center` | Default center point |
|
|
425
|
+
| `top` | Top center |
|
|
426
|
+
| `bottom` | Bottom center |
|
|
427
|
+
| `left` | Left center |
|
|
428
|
+
| `right` | Right center |
|
|
429
|
+
| `topLeft` | Top-left corner |
|
|
430
|
+
| `topRight` | Top-right corner |
|
|
431
|
+
| `bottomLeft` | Bottom-left corner |
|
|
432
|
+
| `bottomRight` | Bottom-right corner |
|
|
433
|
+
|
|
434
|
+
### Spring Animation
|
|
435
|
+
|
|
436
|
+
Use physics-based spring animations for more natural, bouncy effects:
|
|
437
|
+
|
|
438
|
+
```tsx
|
|
439
|
+
// Enable spring animation
|
|
440
|
+
<PuffPop effect="scale" useSpring>
|
|
441
|
+
<Card />
|
|
442
|
+
</PuffPop>
|
|
443
|
+
|
|
444
|
+
// Customize spring physics
|
|
445
|
+
<PuffPop
|
|
446
|
+
effect="slideUp"
|
|
447
|
+
useSpring
|
|
448
|
+
springConfig={{
|
|
449
|
+
tension: 150, // Higher = faster, snappier
|
|
450
|
+
friction: 8, // Higher = less bouncy
|
|
451
|
+
}}
|
|
452
|
+
>
|
|
453
|
+
<Modal />
|
|
454
|
+
</PuffPop>
|
|
455
|
+
|
|
456
|
+
// Very bouncy spring
|
|
457
|
+
<PuffPop
|
|
458
|
+
effect="scale"
|
|
459
|
+
useSpring
|
|
460
|
+
springConfig={{
|
|
461
|
+
tension: 200,
|
|
462
|
+
friction: 5,
|
|
463
|
+
bounciness: 12,
|
|
464
|
+
}}
|
|
465
|
+
>
|
|
466
|
+
<Button />
|
|
467
|
+
</PuffPop>
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Spring config options:
|
|
471
|
+
|
|
472
|
+
| Option | Default | Description |
|
|
473
|
+
|--------|---------|-------------|
|
|
474
|
+
| `tension` | `100` | Spring stiffness (higher = faster) |
|
|
475
|
+
| `friction` | `10` | Damping (higher = less oscillation) |
|
|
476
|
+
| `speed` | `12` | Animation speed multiplier |
|
|
477
|
+
| `bounciness` | `8` | Bounce amount (higher = more bouncy) |
|
|
478
|
+
|
|
184
479
|
## Props
|
|
185
480
|
|
|
186
481
|
| Prop | Type | Default | Description |
|
|
@@ -200,6 +495,20 @@ function App() {
|
|
|
200
495
|
| `loopDelay` | `number` | `0` | Delay between loop iterations in ms |
|
|
201
496
|
| `respectReduceMotion` | `boolean` | `true` | Respect system reduce motion setting |
|
|
202
497
|
| `testID` | `string` | - | Test ID for testing purposes |
|
|
498
|
+
| `exitEffect` | `PuffPopEffect` | - | Animation effect for exit (defaults to enter effect) |
|
|
499
|
+
| `exitDuration` | `number` | - | Duration for exit animation (defaults to duration) |
|
|
500
|
+
| `exitEasing` | `PuffPopEasing` | - | Easing for exit animation (defaults to easing) |
|
|
501
|
+
| `exitDelay` | `number` | `0` | Delay before exit animation starts in ms |
|
|
502
|
+
| `initialOpacity` | `number` | - | Custom initial opacity (0-1) |
|
|
503
|
+
| `initialScale` | `number` | - | Custom initial scale value |
|
|
504
|
+
| `initialRotate` | `number` | - | Custom initial rotation in degrees |
|
|
505
|
+
| `initialTranslateX` | `number` | - | Custom initial X translation in pixels |
|
|
506
|
+
| `initialTranslateY` | `number` | - | Custom initial Y translation in pixels |
|
|
507
|
+
| `reverse` | `boolean` | `false` | Reverse animation direction |
|
|
508
|
+
| `intensity` | `number` | `1` | Animation intensity multiplier (0-1) |
|
|
509
|
+
| `anchorPoint` | `PuffPopAnchorPoint` | `'center'` | Transform origin for scale/rotate |
|
|
510
|
+
| `useSpring` | `boolean` | `false` | Use physics-based spring animation |
|
|
511
|
+
| `springConfig` | `PuffPopSpringConfig` | - | Spring animation settings (tension, friction, etc.) |
|
|
203
512
|
|
|
204
513
|
### PuffPopGroup Props
|
|
205
514
|
|
|
@@ -222,6 +531,22 @@ function App() {
|
|
|
222
531
|
| `gap` | `number` | - | Gap between children |
|
|
223
532
|
| `respectReduceMotion` | `boolean` | `true` | Respect system reduce motion setting |
|
|
224
533
|
| `testID` | `string` | - | Test ID for testing purposes |
|
|
534
|
+
| `exitEffect` | `PuffPopEffect` | - | Exit animation effect for all children |
|
|
535
|
+
| `exitDuration` | `number` | - | Exit duration for all children |
|
|
536
|
+
| `exitEasing` | `PuffPopEasing` | - | Exit easing for all children |
|
|
537
|
+
| `exitDelay` | `number` | `0` | Exit delay for all children |
|
|
538
|
+
| `initialOpacity` | `number` | - | Custom initial opacity for all children |
|
|
539
|
+
| `initialScale` | `number` | - | Custom initial scale for all children |
|
|
540
|
+
| `initialRotate` | `number` | - | Custom initial rotation for all children |
|
|
541
|
+
| `initialTranslateX` | `number` | - | Custom initial X translation for all children |
|
|
542
|
+
| `initialTranslateY` | `number` | - | Custom initial Y translation for all children |
|
|
543
|
+
| `reverse` | `boolean` | `false` | Reverse animation direction for all children |
|
|
544
|
+
| `intensity` | `number` | `1` | Animation intensity multiplier for all children |
|
|
545
|
+
| `anchorPoint` | `PuffPopAnchorPoint` | `'center'` | Transform origin for all children |
|
|
546
|
+
| `useSpring` | `boolean` | `false` | Use spring animation for all children |
|
|
547
|
+
| `springConfig` | `PuffPopSpringConfig` | - | Spring settings for all children |
|
|
548
|
+
| `exitStaggerDelay` | `number` | `0` | Delay between each child's exit animation |
|
|
549
|
+
| `exitStaggerDirection` | `'forward' \| 'reverse' \| 'center' \| 'edges'` | `'reverse'` | Direction of exit stagger |
|
|
225
550
|
|
|
226
551
|
### Animation Effects (`PuffPopEffect`)
|
|
227
552
|
|
|
@@ -238,6 +563,11 @@ function App() {
|
|
|
238
563
|
| `flip` | 3D flip effect |
|
|
239
564
|
| `zoom` | Zoom with slight overshoot |
|
|
240
565
|
| `rotateScale` | Rotate + Scale combined |
|
|
566
|
+
| `shake` | Shake left-right (for alerts, errors) |
|
|
567
|
+
| `pulse` | Pulse heartbeat effect (for emphasis) |
|
|
568
|
+
| `swing` | Swing like pendulum (for menus) |
|
|
569
|
+
| `wobble` | Wobble with tilt (playful entrance) |
|
|
570
|
+
| `elastic` | Elastic stretch effect (springy feel) |
|
|
241
571
|
|
|
242
572
|
### Easing Types (`PuffPopEasing`)
|
|
243
573
|
|