@rootnative/inertia 0.0.6 → 0.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/README.md +7 -1
  3. package/dist/chunk-24NUL23E.js +8 -0
  4. package/dist/chunk-4XBX7KOD.js +8 -0
  5. package/dist/{chunk-OBRGJAST.js → chunk-6AN5X3YE.js} +3 -3
  6. package/dist/{chunk-5MGWHOSV.js → chunk-6NOCY764.js} +2 -2
  7. package/dist/{chunk-PFPO7DX2.mjs → chunk-6YIUETBF.mjs} +1 -1
  8. package/dist/{chunk-767UKZXG.js → chunk-E3ALFSH2.js} +76 -33
  9. package/dist/chunk-EN4PN7X3.mjs +22 -0
  10. package/dist/{chunk-CMHVF6F4.mjs → chunk-GSUC4HWP.mjs} +1 -1
  11. package/dist/chunk-IHVMNOS4.js +28 -0
  12. package/dist/{chunk-2ICQLWH2.mjs → chunk-IX6SEOSK.mjs} +53 -12
  13. package/dist/{chunk-C3EDC5ZW.mjs → chunk-JBK5ZLMH.mjs} +1 -1
  14. package/dist/{chunk-OW5XTGVN.mjs → chunk-L4JFECXU.mjs} +2 -2
  15. package/dist/{chunk-BAAQI37F.mjs → chunk-M4766VUV.mjs} +1 -1
  16. package/dist/{chunk-Z3HCJ43H.mjs → chunk-MFAFB4K7.mjs} +1 -1
  17. package/dist/{chunk-4NAMD62I.js → chunk-MUT6BTZS.js} +7 -7
  18. package/dist/{chunk-F7LJX56B.mjs → chunk-QNLSCOR5.mjs} +1 -1
  19. package/dist/{chunk-REYL77RE.mjs → chunk-W7NTRSPD.mjs} +17 -10
  20. package/dist/{chunk-PM6CVGXJ.js → chunk-WNVHPMBI.js} +16 -8
  21. package/dist/chunk-Z5USXWTE.js +8 -0
  22. package/dist/{chunk-X7B5WR5A.js → chunk-ZBHQPVWE.js} +2 -2
  23. package/dist/gestureLayer/index.d.mts +2 -2
  24. package/dist/gestureLayer/index.d.ts +2 -2
  25. package/dist/gestureLayer/index.js +10 -10
  26. package/dist/gestureLayer/index.mjs +3 -3
  27. package/dist/index.d.mts +89 -10
  28. package/dist/index.d.ts +89 -10
  29. package/dist/index.js +67 -49
  30. package/dist/index.mjs +21 -18
  31. package/dist/motion/FlatList.d.mts +53 -0
  32. package/dist/motion/FlatList.d.ts +53 -0
  33. package/dist/motion/FlatList.js +13 -0
  34. package/dist/motion/FlatList.mjs +4 -0
  35. package/dist/motion/Image.d.mts +1 -1
  36. package/dist/motion/Image.d.ts +1 -1
  37. package/dist/motion/Image.js +5 -5
  38. package/dist/motion/Image.mjs +4 -4
  39. package/dist/motion/Pressable.d.mts +1 -1
  40. package/dist/motion/Pressable.d.ts +1 -1
  41. package/dist/motion/Pressable.js +5 -5
  42. package/dist/motion/Pressable.mjs +4 -4
  43. package/dist/motion/ScrollView.d.mts +1 -1
  44. package/dist/motion/ScrollView.d.ts +1 -1
  45. package/dist/motion/ScrollView.js +5 -5
  46. package/dist/motion/ScrollView.mjs +4 -4
  47. package/dist/motion/Text.d.mts +1 -1
  48. package/dist/motion/Text.d.ts +1 -1
  49. package/dist/motion/Text.js +5 -5
  50. package/dist/motion/Text.mjs +4 -4
  51. package/dist/motion/View.d.mts +1 -1
  52. package/dist/motion/View.d.ts +1 -1
  53. package/dist/motion/View.js +5 -5
  54. package/dist/motion/View.mjs +4 -4
  55. package/dist/touch/index.d.mts +1 -1
  56. package/dist/touch/index.d.ts +1 -1
  57. package/dist/touch/index.js +3 -3
  58. package/dist/touch/index.mjs +1 -1
  59. package/dist/{types-BQgLJeQG.d.mts → types-DyJpG64F.d.mts} +1 -1
  60. package/dist/{types-BQgLJeQG.d.ts → types-DyJpG64F.d.ts} +1 -1
  61. package/dist/{useGesture-DfaTx-3t.d.mts → useGesture-CnZQnYHH.d.mts} +1 -1
  62. package/dist/{useGesture-B0_CzOUz.d.ts → useGesture-DbH46EBp.d.ts} +1 -1
  63. package/jest-setup.js +7 -1
  64. package/llms.txt +25 -4
  65. package/package.json +8 -1
  66. package/src/index.ts +5 -0
  67. package/src/motion/FlatList.tsx +77 -0
  68. package/src/motion/createMotionComponent.tsx +68 -10
  69. package/src/motion/index.ts +3 -0
  70. package/src/stagger/Stagger.tsx +75 -0
  71. package/src/stagger/StaggerContext.ts +25 -0
  72. package/src/stagger/index.ts +2 -0
  73. package/src/transitions/index.ts +6 -1
  74. package/src/transitions/resolve.ts +7 -1
  75. package/src/transitions/runtime.ts +22 -7
  76. package/src/values/useScroll.ts +9 -5
  77. package/dist/chunk-FWWVHLXB.js +0 -8
  78. package/dist/chunk-K5SI6VXS.js +0 -8
  79. package/dist/chunk-STARIT6W.js +0 -8
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-2ICQLWH2.mjs';
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
2
  import { ScrollView } from 'react-native';
3
3
 
4
4
  var MotionScrollView = createMotionComponent(ScrollView);
@@ -1,4 +1,4 @@
1
- import { stableSig, isTopLevelTransition } from './chunk-REYL77RE.mjs';
1
+ import { stableSig, isTopLevelTransition } from './chunk-W7NTRSPD.mjs';
2
2
  import { createContext, useContext, useMemo } from 'react';
3
3
  import { useReducedMotion } from 'react-native-reanimated';
4
4
  import { jsx } from 'react/jsx-runtime';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkOBRGJAST_js = require('./chunk-OBRGJAST.js');
4
- var chunkPM6CVGXJ_js = require('./chunk-PM6CVGXJ.js');
3
+ var chunk6AN5X3YE_js = require('./chunk-6AN5X3YE.js');
4
+ var chunkWNVHPMBI_js = require('./chunk-WNVHPMBI.js');
5
5
  var react = require('react');
6
6
  var reactNativeReanimated = require('react-native-reanimated');
7
7
 
@@ -10,12 +10,12 @@ function useGesture(transition) {
10
10
  const focused = reactNativeReanimated.useSharedValue(0);
11
11
  const focusVisible = reactNativeReanimated.useSharedValue(0);
12
12
  const hovered = reactNativeReanimated.useSharedValue(0);
13
- const shouldReduceMotion = chunkOBRGJAST_js.useShouldReduceMotion();
14
- const resolved = chunkOBRGJAST_js.resolveNamedTransitionProp(transition, chunkOBRGJAST_js.useNamedTransitions());
13
+ const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
14
+ const resolved = chunk6AN5X3YE_js.resolveNamedTransitionProp(transition, chunk6AN5X3YE_js.useNamedTransitions());
15
15
  const setLayer = react.useCallback(
16
16
  (sv, layer, target) => {
17
17
  const cfg = shouldReduceMotion ? { type: "no-animation" } : layerTransition(layer, resolved) ?? { type: "spring" };
18
- sv.value = chunkPM6CVGXJ_js.resolveTransition(cfg, target);
18
+ sv.value = chunkWNVHPMBI_js.resolveTransition(cfg, target);
19
19
  },
20
20
  // The transition is intentionally read on every call rather than cooked
21
21
  // into the dep array — a fresh literal each render would otherwise
@@ -34,7 +34,7 @@ function useGesture(transition) {
34
34
  onHoverOut: () => setLayer(hovered, "hovered", 0),
35
35
  onFocus: () => {
36
36
  setLayer(focused, "focused", 1);
37
- if (chunkOBRGJAST_js.isFocusVisible()) setLayer(focusVisible, "focusVisible", 1);
37
+ if (chunk6AN5X3YE_js.isFocusVisible()) setLayer(focusVisible, "focusVisible", 1);
38
38
  },
39
39
  onBlur: () => {
40
40
  setLayer(focused, "focused", 0);
@@ -47,7 +47,7 @@ function useGesture(transition) {
47
47
  }
48
48
  function layerTransition(layer, transition) {
49
49
  if (!transition) return void 0;
50
- if (chunkPM6CVGXJ_js.isTopLevelTransition(transition)) return transition;
50
+ if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
51
51
  return transition[layer];
52
52
  }
53
53
 
@@ -1,4 +1,4 @@
1
- import { createMotionComponent } from './chunk-2ICQLWH2.mjs';
1
+ import { createMotionComponent } from './chunk-IX6SEOSK.mjs';
2
2
  import { Text } from 'react-native';
3
3
 
4
4
  var MotionText = createMotionComponent(Text);
@@ -1,5 +1,5 @@
1
1
  import { isWorkletFunction } from 'react-native-worklets';
2
- import { withSequence, Easing, withDecay, withTiming, withSpring, withRepeat, withDelay } from 'react-native-reanimated';
2
+ import { withDelay, withSequence, Easing, withDecay, withTiming, withSpring, withRepeat } from 'react-native-reanimated';
3
3
 
4
4
  // src/transitions/easing.ts
5
5
 
@@ -210,26 +210,33 @@ function bezier(x1, y1, x2, y2, source) {
210
210
  return Easing.bezier(x1, y1, x2, y2);
211
211
  }
212
212
  var DEFAULT_TIMING_DURATION2 = 250;
213
- function buildReleaseAnimation(transition, toValue) {
213
+ function buildReleaseAnimation(transition, toValue, callback) {
214
214
  "worklet";
215
- if (transition.type === "no-animation") return toValue;
215
+ if (transition.type === "no-animation") {
216
+ if (callback) callback(true, toValue);
217
+ return toValue;
218
+ }
216
219
  if (transition.type === "decay") {
217
220
  const cfg = { velocity: transition.velocity ?? 0 };
218
221
  if (transition.deceleration !== void 0) {
219
222
  cfg.deceleration = transition.deceleration;
220
223
  }
221
224
  if (transition.clamp !== void 0) cfg.clamp = transition.clamp;
222
- return withDecay(cfg);
225
+ return withDecay(cfg, callback);
223
226
  }
224
227
  if (transition.type === "timing") {
225
228
  const e = transition.easing;
226
229
  const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? Easing.inOut(Easing.ease);
227
- return withTiming(toValue, {
228
- duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
229
- easing: easingFn
230
- });
230
+ return withTiming(
231
+ toValue,
232
+ {
233
+ duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
234
+ easing: easingFn
235
+ },
236
+ callback
237
+ );
231
238
  }
232
- return withSpring(toValue, springToReanimated(transition));
239
+ return withSpring(toValue, springToReanimated(transition), callback);
233
240
  }
234
241
 
235
242
  // src/transitions/keys.ts
@@ -277,4 +284,4 @@ function stableStringify(v) {
277
284
  return "{" + keys.map((k) => JSON.stringify(k) + ":" + stableStringify(obj[k])).join(",") + "}";
278
285
  }
279
286
 
280
- export { DEFAULT_SPRING, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
287
+ export { DEFAULT_SPRING, applyDelay, buildReleaseAnimation, cubicBezier, ensureWorkletEasing, isTopLevelTransition, resolveAnimatableValue, resolveTransition, springToReanimated, stableSig, warnNonWorkletOnce, warnOnce };
@@ -212,26 +212,33 @@ function bezier(x1, y1, x2, y2, source) {
212
212
  return reactNativeReanimated.Easing.bezier(x1, y1, x2, y2);
213
213
  }
214
214
  var DEFAULT_TIMING_DURATION2 = 250;
215
- function buildReleaseAnimation(transition, toValue) {
215
+ function buildReleaseAnimation(transition, toValue, callback) {
216
216
  "worklet";
217
- if (transition.type === "no-animation") return toValue;
217
+ if (transition.type === "no-animation") {
218
+ if (callback) callback(true, toValue);
219
+ return toValue;
220
+ }
218
221
  if (transition.type === "decay") {
219
222
  const cfg = { velocity: transition.velocity ?? 0 };
220
223
  if (transition.deceleration !== void 0) {
221
224
  cfg.deceleration = transition.deceleration;
222
225
  }
223
226
  if (transition.clamp !== void 0) cfg.clamp = transition.clamp;
224
- return reactNativeReanimated.withDecay(cfg);
227
+ return reactNativeReanimated.withDecay(cfg, callback);
225
228
  }
226
229
  if (transition.type === "timing") {
227
230
  const e = transition.easing;
228
231
  const easingFn = e && typeof e === "object" && "factory" in e ? e.factory() : e ?? reactNativeReanimated.Easing.inOut(reactNativeReanimated.Easing.ease);
229
- return reactNativeReanimated.withTiming(toValue, {
230
- duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
231
- easing: easingFn
232
- });
232
+ return reactNativeReanimated.withTiming(
233
+ toValue,
234
+ {
235
+ duration: transition.duration ?? DEFAULT_TIMING_DURATION2,
236
+ easing: easingFn
237
+ },
238
+ callback
239
+ );
233
240
  }
234
- return reactNativeReanimated.withSpring(toValue, springToReanimated(transition));
241
+ return reactNativeReanimated.withSpring(toValue, springToReanimated(transition), callback);
235
242
  }
236
243
 
237
244
  // src/transitions/keys.ts
@@ -280,6 +287,7 @@ function stableStringify(v) {
280
287
  }
281
288
 
282
289
  exports.DEFAULT_SPRING = DEFAULT_SPRING;
290
+ exports.applyDelay = applyDelay;
283
291
  exports.buildReleaseAnimation = buildReleaseAnimation;
284
292
  exports.cubicBezier = cubicBezier;
285
293
  exports.ensureWorkletEasing = ensureWorkletEasing;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
+ var reactNative = require('react-native');
5
+
6
+ var MotionImage = chunkE3ALFSH2_js.createMotionComponent(reactNative.Image);
7
+
8
+ exports.MotionImage = MotionImage;
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var chunk767UKZXG_js = require('./chunk-767UKZXG.js');
3
+ var chunkE3ALFSH2_js = require('./chunk-E3ALFSH2.js');
4
4
  var reactNative = require('react-native');
5
5
 
6
- var MotionScrollView = chunk767UKZXG_js.createMotionComponent(reactNative.ScrollView);
6
+ var MotionScrollView = chunkE3ALFSH2_js.createMotionComponent(reactNative.ScrollView);
7
7
 
8
8
  exports.MotionScrollView = MotionScrollView;
@@ -1,6 +1,6 @@
1
1
  import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
2
- import { U as UseGestureHandlers } from '../useGesture-DfaTx-3t.mjs';
3
- import { a as TransitionInput, G as GestureLayerTransitions } from '../types-BQgLJeQG.mjs';
2
+ import { U as UseGestureHandlers } from '../useGesture-CnZQnYHH.mjs';
3
+ import { b as TransitionInput, G as GestureLayerTransitions } from '../types-DyJpG64F.mjs';
4
4
  import 'react';
5
5
  import 'react-native';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { SharedValue, AnimatedStyle } from 'react-native-reanimated';
2
- import { U as UseGestureHandlers } from '../useGesture-B0_CzOUz.js';
3
- import { a as TransitionInput, G as GestureLayerTransitions } from '../types-BQgLJeQG.js';
2
+ import { U as UseGestureHandlers } from '../useGesture-DbH46EBp.js';
3
+ import { b as TransitionInput, G as GestureLayerTransitions } from '../types-DyJpG64F.js';
4
4
  import 'react';
5
5
  import 'react-native';
6
6
 
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var chunk4NAMD62I_js = require('../chunk-4NAMD62I.js');
4
- var chunkOBRGJAST_js = require('../chunk-OBRGJAST.js');
5
- var chunkPM6CVGXJ_js = require('../chunk-PM6CVGXJ.js');
3
+ var chunkMUT6BTZS_js = require('../chunk-MUT6BTZS.js');
4
+ var chunk6AN5X3YE_js = require('../chunk-6AN5X3YE.js');
5
+ var chunkWNVHPMBI_js = require('../chunk-WNVHPMBI.js');
6
6
  var react = require('react');
7
7
  var reactNativeReanimated = require('react-native-reanimated');
8
8
 
9
9
  function useGestureLayer(states, options = {}) {
10
10
  const { disabled: isDisabled = false, transition: transitionInput } = options;
11
- const shouldReduceMotion = chunkOBRGJAST_js.useShouldReduceMotion();
12
- const transition = chunkOBRGJAST_js.resolveNamedTransitionProp(
11
+ const shouldReduceMotion = chunk6AN5X3YE_js.useShouldReduceMotion();
12
+ const transition = chunk6AN5X3YE_js.resolveNamedTransitionProp(
13
13
  transitionInput,
14
- chunkOBRGJAST_js.useNamedTransitions()
14
+ chunk6AN5X3YE_js.useNamedTransitions()
15
15
  );
16
- const gesture = chunk4NAMD62I_js.useGesture(transition);
16
+ const gesture = chunkMUT6BTZS_js.useGesture(transition);
17
17
  const disabledProgress = reactNativeReanimated.useSharedValue(0);
18
- const transitionSig = chunkPM6CVGXJ_js.stableSig(transition);
18
+ const transitionSig = chunkWNVHPMBI_js.stableSig(transition);
19
19
  react.useEffect(() => {
20
20
  const target = isDisabled ? 1 : 0;
21
21
  const cfg = shouldReduceMotion ? { type: "no-animation" } : disabledTransition(transition) ?? { type: "spring" };
22
- disabledProgress.value = chunkPM6CVGXJ_js.resolveTransition(cfg, target);
22
+ disabledProgress.value = chunkWNVHPMBI_js.resolveTransition(cfg, target);
23
23
  }, [isDisabled, shouldReduceMotion, transitionSig, disabledProgress]);
24
24
  const meta = react.useMemo(() => {
25
25
  const layers = {
@@ -154,7 +154,7 @@ function useGestureLayer(states, options = {}) {
154
154
  }
155
155
  function disabledTransition(transition) {
156
156
  if (!transition) return void 0;
157
- if (chunkPM6CVGXJ_js.isTopLevelTransition(transition)) return transition;
157
+ if (chunkWNVHPMBI_js.isTopLevelTransition(transition)) return transition;
158
158
  return void 0;
159
159
  }
160
160
 
@@ -1,6 +1,6 @@
1
- import { useGesture } from '../chunk-OW5XTGVN.mjs';
2
- import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-Z3HCJ43H.mjs';
3
- import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-REYL77RE.mjs';
1
+ import { useGesture } from '../chunk-L4JFECXU.mjs';
2
+ import { useShouldReduceMotion, resolveNamedTransitionProp, useNamedTransitions } from '../chunk-MFAFB4K7.mjs';
3
+ import { stableSig, resolveTransition, isTopLevelTransition } from '../chunk-W7NTRSPD.mjs';
4
4
  import { useEffect, useMemo } from 'react';
5
5
  import { useSharedValue, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
6
6
 
package/dist/index.d.mts CHANGED
@@ -2,11 +2,12 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
5
- import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-BQgLJeQG.mjs';
6
- export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-BQgLJeQG.mjs';
5
+ import { M as MotionComponent, V as VariantsMap, a as MotionProps, N as NamedTransitions, b as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, c as TransitionName, d as VariantController } from './types-DyJpG64F.mjs';
6
+ export { e as AnimateStyle, f as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, g as EasingFunction, h as EasingFunctionFactory, i as GestureSubStates, j as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, k as RepeatConfig, l as SequenceStep, m as TimingTransition, n as Transition } from './types-DyJpG64F.mjs';
7
7
  import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
8
8
  export { SharedValue } from 'react-native-reanimated';
9
- export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-DfaTx-3t.mjs';
9
+ export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-CnZQnYHH.mjs';
10
+ export { MotionFlatList } from './motion/FlatList.mjs';
10
11
  export { MotionImage } from './motion/Image.mjs';
11
12
  export { MotionPressable } from './motion/Pressable.mjs';
12
13
  export { MotionScrollView } from './motion/ScrollView.mjs';
@@ -36,6 +37,9 @@ declare const Motion: {
36
37
  readonly Image: MotionComponent<typeof react_native.Image>;
37
38
  readonly Pressable: MotionComponent<react.ForwardRefExoticComponent<react_native.PressableProps & react.RefAttributes<react_native.View>>>;
38
39
  readonly ScrollView: MotionComponent<typeof react_native.ScrollView>;
40
+ readonly FlatList: <ItemT = any, V extends VariantsMap<react_native.FlatListProps<ItemT>> = VariantsMap<react_native.FlatListProps<ItemT>>>(props: react_native.FlatListProps<ItemT> & MotionProps<react_native.FlatListProps<ItemT>, V> & {
41
+ ref?: React.Ref<react_native.FlatList<ItemT>>;
42
+ }) => React.ReactElement;
39
43
  };
40
44
 
41
45
  /**
@@ -170,6 +174,64 @@ interface PresenceContextValue {
170
174
  */
171
175
  declare function usePresence(): PresenceContextValue | null;
172
176
 
177
+ interface StaggerProps {
178
+ children?: ReactNode;
179
+ /**
180
+ * Milliseconds between consecutive children. Child `i` (in render order)
181
+ * receives a delay of `delay + i * interval`.
182
+ */
183
+ interval: number;
184
+ /**
185
+ * Base delay in milliseconds applied to every child before the interval,
186
+ * so the whole cascade can start late without pushing the spacing into
187
+ * each child. Defaults to `0`.
188
+ */
189
+ delay?: number;
190
+ /**
191
+ * Which end of the child list starts the cascade. `'first'` (default)
192
+ * staggers top-down in render order; `'last'` reverses it, so the final
193
+ * child animates first.
194
+ */
195
+ from?: 'first' | 'last';
196
+ /**
197
+ * Turn the stagger on or off in one place. When `false`, every child gets
198
+ * a delay of `0` — the single-switch escape hatch for "cascade in, but
199
+ * not back out": pass `enabled={revealed}` and the hide direction snaps
200
+ * together. Defaults to `true`.
201
+ */
202
+ enabled?: boolean;
203
+ }
204
+ /**
205
+ * Assign each child a stagger delay from its position, so a list entrance
206
+ * cascades without every child computing `index * ms` itself.
207
+ *
208
+ * The parent owns the timing: reordering, filtering, or reversing the list
209
+ * re-derives every delay from the new render order, and `enabled` turns the
210
+ * whole cascade off in one place. Each child slot gets its own provider, so
211
+ * a `Motion.*` primitive anywhere inside child `i`'s subtree inherits child
212
+ * `i`'s delay.
213
+ *
214
+ * The delay applies to the declarative animations of the `Motion.*`
215
+ * primitives underneath — the mount animation (`initial` → `animate`) and
216
+ * any later `animate` change. It deliberately does not delay `gesture`
217
+ * feedback, `<Presence>` exits, or reduced-motion snaps.
218
+ *
219
+ * `<Stagger>` renders no host view — only per-child context providers.
220
+ */
221
+ declare function Stagger({ children, interval, delay, from, enabled, }: StaggerProps): react.JSX.Element;
222
+
223
+ /**
224
+ * The stagger delay (in milliseconds) assigned to this element's child slot
225
+ * by the nearest `<Stagger>` ancestor. `0` when there is none, when the
226
+ * stagger is disabled, or for the first child of a zero-`delay` stagger.
227
+ *
228
+ * The `Motion.*` primitives consume this automatically. Custom animated
229
+ * components built on `resolveTransition` / `resolveAnimatableValue` call
230
+ * this hook and add the returned value to their animation delay so they
231
+ * participate in a `<Stagger>` the same way the built-in primitives do.
232
+ */
233
+ declare function useStaggerDelay(): number;
234
+
173
235
  /**
174
236
  * UI-thread callback Reanimated invokes when an animation settles. Must be a
175
237
  * worklet — callers either author one with `'worklet'` or build one via
@@ -183,6 +245,13 @@ type AnimationCallback = (finished?: boolean, current?: number | string) => void
183
245
  * `withDecay` call.
184
246
  */
185
247
  type CallbackFactory = (phase: 'step' | 'animation', step: number | undefined) => AnimationCallback | undefined;
248
+ /**
249
+ * Wrap an animation in `withDelay`. A missing / zero / negative delay is a
250
+ * pass-through. Exported for the factory's stagger wrap, which must delay a
251
+ * fully-resolved animation exactly once — merging the delay into the base
252
+ * config instead would re-apply it per sequence step.
253
+ */
254
+ declare function applyDelay(animation: unknown, delay: number | undefined): unknown;
186
255
  /**
187
256
  * Build a Reanimated animation for a single property. Runs on the JS thread
188
257
  * once per change and produces a baked `withSpring` / `withTiming` /
@@ -289,8 +358,14 @@ declare function ensureWorkletEasing(easing: EasingInput | undefined): ((t: numb
289
358
  *
290
359
  * For decay transitions, `toValue` is ignored — decay decelerates from the
291
360
  * SV's current position via its own physics. Pass `0` if you don't have one.
361
+ *
362
+ * `callback`, when provided, fires once when the animation settles — the same
363
+ * `(finished) => void` shape Reanimated's `with*` factories accept. It runs on
364
+ * the UI thread, so bridge to JS with `runOnJS(...)` inside it. For
365
+ * `no-animation` the callback fires synchronously with `finished: true`, since
366
+ * a direct assignment has no settle point of its own.
292
367
  */
293
- declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number): unknown;
368
+ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number, callback?: AnimationCallback): unknown;
294
369
 
295
370
  /**
296
371
  * The one colour spelling Reanimated's animation drivers cannot accept.
@@ -731,10 +806,10 @@ interface UseScrollResult {
731
806
  /** Vertical scroll offset in points. */
732
807
  scrollY: SharedValue<number>;
733
808
  /**
734
- * Handler to pass to a `Motion.ScrollView`'s `onScroll` prop (or any other
735
- * Reanimated `Animated.ScrollView`). The handler is opaque to JS it runs
736
- * as a worklet — but the type narrows to the same shape RN's native
737
- * `onScroll` prop expects so it composes cleanly.
809
+ * Handler to pass to the `onScroll` prop of `Motion.ScrollView` or
810
+ * `Motion.FlatList` (or any other Reanimated animated scroller). The handler
811
+ * is opaque to JS — it runs as a worklet — but the type narrows to the same
812
+ * shape RN's native `onScroll` prop expects so it composes cleanly.
738
813
  */
739
814
  onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
740
815
  }
@@ -766,9 +841,13 @@ interface UseScrollResult {
766
841
  * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,
767
842
  * `useTransform`) without a JS-thread bounce.
768
843
  *
769
- * Remember to set `scrollEventThrottle={16}` on the `ScrollView` for 60Hz
844
+ * Remember to set `scrollEventThrottle={16}` on a `Motion.ScrollView` for 60Hz
770
845
  * updates — RN's default is to dispatch on every event, which on iOS still
771
846
  * means one per frame, but Android benefits from the explicit cap.
847
+ *
848
+ * `Motion.FlatList` needs no such setting — it defaults `scrollEventThrottle`
849
+ * to 1 for you. Prefer it over `Motion.ScrollView` for long or unbounded lists:
850
+ * it virtualizes, and both accept this handler.
772
851
  */
773
852
  declare function useScroll(): UseScrollResult;
774
853
 
@@ -897,4 +976,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
897
976
  */
898
977
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
899
978
 
900
- export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
979
+ export { AnimatableValue, type AnimationCallback, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, MotionProps, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, Stagger, type StaggerProps, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, VariantsMap, applyDelay, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useStaggerDelay, useTransform, useVariants };
package/dist/index.d.ts CHANGED
@@ -2,11 +2,12 @@ import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
3
  import * as react_native from 'react-native';
4
4
  import { NativeSyntheticEvent, NativeScrollEvent } from 'react-native';
5
- import { M as MotionComponent, N as NamedTransitions, a as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, b as TransitionName, V as VariantController } from './types-BQgLJeQG.js';
6
- export { c as AnimateStyle, d as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, e as EasingFunction, f as EasingFunctionFactory, g as GestureSubStates, h as MotionProps, i as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, j as RepeatConfig, k as SequenceStep, l as TimingTransition, m as Transition, n as VariantsMap } from './types-BQgLJeQG.js';
5
+ import { M as MotionComponent, V as VariantsMap, a as MotionProps, N as NamedTransitions, b as TransitionInput, T as TransitionConfig, A as AnimatableValue, E as EasingInput, S as SpringTransition, c as TransitionName, d as VariantController } from './types-DyJpG64F.js';
6
+ export { e as AnimateStyle, f as AnimationCallbackInfo, B as BoxShadowInput, D as DecayTransition, g as EasingFunction, h as EasingFunctionFactory, i as GestureSubStates, j as NoAnimationTransition, P as PerPropertyTransition, R as RegisteredTransitions, k as RepeatConfig, l as SequenceStep, m as TimingTransition, n as Transition } from './types-DyJpG64F.js';
7
7
  import { SharedValue, useAnimatedStyle } from 'react-native-reanimated';
8
8
  export { SharedValue } from 'react-native-reanimated';
9
- export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-B0_CzOUz.js';
9
+ export { U as UseGestureHandlers, a as UseGestureResult, u as useGesture } from './useGesture-DbH46EBp.js';
10
+ export { MotionFlatList } from './motion/FlatList.js';
10
11
  export { MotionImage } from './motion/Image.js';
11
12
  export { MotionPressable } from './motion/Pressable.js';
12
13
  export { MotionScrollView } from './motion/ScrollView.js';
@@ -36,6 +37,9 @@ declare const Motion: {
36
37
  readonly Image: MotionComponent<typeof react_native.Image>;
37
38
  readonly Pressable: MotionComponent<react.ForwardRefExoticComponent<react_native.PressableProps & react.RefAttributes<react_native.View>>>;
38
39
  readonly ScrollView: MotionComponent<typeof react_native.ScrollView>;
40
+ readonly FlatList: <ItemT = any, V extends VariantsMap<react_native.FlatListProps<ItemT>> = VariantsMap<react_native.FlatListProps<ItemT>>>(props: react_native.FlatListProps<ItemT> & MotionProps<react_native.FlatListProps<ItemT>, V> & {
41
+ ref?: React.Ref<react_native.FlatList<ItemT>>;
42
+ }) => React.ReactElement;
39
43
  };
40
44
 
41
45
  /**
@@ -170,6 +174,64 @@ interface PresenceContextValue {
170
174
  */
171
175
  declare function usePresence(): PresenceContextValue | null;
172
176
 
177
+ interface StaggerProps {
178
+ children?: ReactNode;
179
+ /**
180
+ * Milliseconds between consecutive children. Child `i` (in render order)
181
+ * receives a delay of `delay + i * interval`.
182
+ */
183
+ interval: number;
184
+ /**
185
+ * Base delay in milliseconds applied to every child before the interval,
186
+ * so the whole cascade can start late without pushing the spacing into
187
+ * each child. Defaults to `0`.
188
+ */
189
+ delay?: number;
190
+ /**
191
+ * Which end of the child list starts the cascade. `'first'` (default)
192
+ * staggers top-down in render order; `'last'` reverses it, so the final
193
+ * child animates first.
194
+ */
195
+ from?: 'first' | 'last';
196
+ /**
197
+ * Turn the stagger on or off in one place. When `false`, every child gets
198
+ * a delay of `0` — the single-switch escape hatch for "cascade in, but
199
+ * not back out": pass `enabled={revealed}` and the hide direction snaps
200
+ * together. Defaults to `true`.
201
+ */
202
+ enabled?: boolean;
203
+ }
204
+ /**
205
+ * Assign each child a stagger delay from its position, so a list entrance
206
+ * cascades without every child computing `index * ms` itself.
207
+ *
208
+ * The parent owns the timing: reordering, filtering, or reversing the list
209
+ * re-derives every delay from the new render order, and `enabled` turns the
210
+ * whole cascade off in one place. Each child slot gets its own provider, so
211
+ * a `Motion.*` primitive anywhere inside child `i`'s subtree inherits child
212
+ * `i`'s delay.
213
+ *
214
+ * The delay applies to the declarative animations of the `Motion.*`
215
+ * primitives underneath — the mount animation (`initial` → `animate`) and
216
+ * any later `animate` change. It deliberately does not delay `gesture`
217
+ * feedback, `<Presence>` exits, or reduced-motion snaps.
218
+ *
219
+ * `<Stagger>` renders no host view — only per-child context providers.
220
+ */
221
+ declare function Stagger({ children, interval, delay, from, enabled, }: StaggerProps): react.JSX.Element;
222
+
223
+ /**
224
+ * The stagger delay (in milliseconds) assigned to this element's child slot
225
+ * by the nearest `<Stagger>` ancestor. `0` when there is none, when the
226
+ * stagger is disabled, or for the first child of a zero-`delay` stagger.
227
+ *
228
+ * The `Motion.*` primitives consume this automatically. Custom animated
229
+ * components built on `resolveTransition` / `resolveAnimatableValue` call
230
+ * this hook and add the returned value to their animation delay so they
231
+ * participate in a `<Stagger>` the same way the built-in primitives do.
232
+ */
233
+ declare function useStaggerDelay(): number;
234
+
173
235
  /**
174
236
  * UI-thread callback Reanimated invokes when an animation settles. Must be a
175
237
  * worklet — callers either author one with `'worklet'` or build one via
@@ -183,6 +245,13 @@ type AnimationCallback = (finished?: boolean, current?: number | string) => void
183
245
  * `withDecay` call.
184
246
  */
185
247
  type CallbackFactory = (phase: 'step' | 'animation', step: number | undefined) => AnimationCallback | undefined;
248
+ /**
249
+ * Wrap an animation in `withDelay`. A missing / zero / negative delay is a
250
+ * pass-through. Exported for the factory's stagger wrap, which must delay a
251
+ * fully-resolved animation exactly once — merging the delay into the base
252
+ * config instead would re-apply it per sequence step.
253
+ */
254
+ declare function applyDelay(animation: unknown, delay: number | undefined): unknown;
186
255
  /**
187
256
  * Build a Reanimated animation for a single property. Runs on the JS thread
188
257
  * once per change and produces a baked `withSpring` / `withTiming` /
@@ -289,8 +358,14 @@ declare function ensureWorkletEasing(easing: EasingInput | undefined): ((t: numb
289
358
  *
290
359
  * For decay transitions, `toValue` is ignored — decay decelerates from the
291
360
  * SV's current position via its own physics. Pass `0` if you don't have one.
361
+ *
362
+ * `callback`, when provided, fires once when the animation settles — the same
363
+ * `(finished) => void` shape Reanimated's `with*` factories accept. It runs on
364
+ * the UI thread, so bridge to JS with `runOnJS(...)` inside it. For
365
+ * `no-animation` the callback fires synchronously with `finished: true`, since
366
+ * a direct assignment has no settle point of its own.
292
367
  */
293
- declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number): unknown;
368
+ declare function buildReleaseAnimation(transition: TransitionConfig, toValue: number, callback?: AnimationCallback): unknown;
294
369
 
295
370
  /**
296
371
  * The one colour spelling Reanimated's animation drivers cannot accept.
@@ -731,10 +806,10 @@ interface UseScrollResult {
731
806
  /** Vertical scroll offset in points. */
732
807
  scrollY: SharedValue<number>;
733
808
  /**
734
- * Handler to pass to a `Motion.ScrollView`'s `onScroll` prop (or any other
735
- * Reanimated `Animated.ScrollView`). The handler is opaque to JS it runs
736
- * as a worklet — but the type narrows to the same shape RN's native
737
- * `onScroll` prop expects so it composes cleanly.
809
+ * Handler to pass to the `onScroll` prop of `Motion.ScrollView` or
810
+ * `Motion.FlatList` (or any other Reanimated animated scroller). The handler
811
+ * is opaque to JS — it runs as a worklet — but the type narrows to the same
812
+ * shape RN's native `onScroll` prop expects so it composes cleanly.
738
813
  */
739
814
  onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
740
815
  }
@@ -766,9 +841,13 @@ interface UseScrollResult {
766
841
  * read from any worklet (`useAnimatedStyle`, `useDerivedValue`,
767
842
  * `useTransform`) without a JS-thread bounce.
768
843
  *
769
- * Remember to set `scrollEventThrottle={16}` on the `ScrollView` for 60Hz
844
+ * Remember to set `scrollEventThrottle={16}` on a `Motion.ScrollView` for 60Hz
770
845
  * updates — RN's default is to dispatch on every event, which on iOS still
771
846
  * means one per frame, but Android benefits from the explicit cap.
847
+ *
848
+ * `Motion.FlatList` needs no such setting — it defaults `scrollEventThrottle`
849
+ * to 1 for you. Prefer it over `Motion.ScrollView` for long or unbounded lists:
850
+ * it virtualizes, and both accept this handler.
772
851
  */
773
852
  declare function useScroll(): UseScrollResult;
774
853
 
@@ -897,4 +976,4 @@ declare function useShadow({ from, to, progress, }: UseShadowOptions): ReturnTyp
897
976
  */
898
977
  declare function useVariants<V extends Readonly<Record<string, object>>>(variants: V, initial?: keyof V & string): VariantController<keyof V & string>;
899
978
 
900
- export { AnimatableValue, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useTransform, useVariants };
979
+ export { AnimatableValue, type AnimationCallback, type Animator, type BoxShadowLayer, type ColorCascadeLayer, type ColorStyleKey, EasingInput, type ExtrapolationMode, type InterpolatedStyleMap, Motion, MotionComponent, MotionConfig, type MotionConfigProps, type MotionConfigValue, MotionProps, NamedTransitions, type NumericStyleKey, Presence, type PresenceContextValue, type ReducedMotion, type ShadowConfig, SpringTransition, Stagger, type StaggerProps, TRANSPARENT, type TransformKey, TransitionConfig, TransitionInput, TransitionName, type UseColorCascadeOptions, type UseColorTransitionOptions, type UseInterpolatedStyleOptions, type UseScrollResult, type UseShadowOptions, type UseTransformOptions, VariantController, VariantsMap, applyDelay, buildReleaseAnimation, createMotionComponent, cubicBezier, ensureWorkletEasing, resolveAnimatableValue, resolveNamedTransition, resolveTransition, useAnimation, useAnimator, useBooleanSpring, useColorCascade, useColorTransition, useInterpolatedStyle, useMotionConfig, useMotionValue, useNamedTransitions, usePresence, useScroll, useShadow, useShouldReduceMotion, useSpring, useStaggerDelay, useTransform, useVariants };