react-native-reanimated-carousel 5.0.0 → 5.1.0

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 (68) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/Pagination/PaginationItem.js +1 -1
  3. package/lib/commonjs/components/Pagination/PaginationItem.js.map +1 -1
  4. package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -1
  5. package/lib/module/components/Pagination/PaginationItem.js +1 -1
  6. package/lib/module/components/Pagination/PaginationItem.js.map +1 -1
  7. package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -1
  8. package/lib/typescript/commonjs/components/ItemLayout.d.ts +2 -2
  9. package/lib/typescript/commonjs/components/ItemLayout.d.ts.map +1 -1
  10. package/lib/typescript/commonjs/components/ItemRenderer.d.ts +3 -3
  11. package/lib/typescript/commonjs/components/ItemRenderer.d.ts.map +1 -1
  12. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts +4 -4
  13. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts.map +1 -1
  14. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts +3 -3
  15. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts.map +1 -1
  16. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts +3 -3
  17. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts.map +1 -1
  18. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts +2 -2
  19. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts.map +1 -1
  20. package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts +2 -2
  21. package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts +1 -1
  23. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts +4 -4
  25. package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/layouts/normal.d.ts +2 -2
  27. package/lib/typescript/commonjs/layouts/parallax.d.ts +6 -6
  28. package/lib/typescript/commonjs/public-types.d.ts +11 -1
  29. package/lib/typescript/commonjs/public-types.d.ts.map +1 -1
  30. package/lib/typescript/commonjs/utils/carousel-math.d.ts +1 -1
  31. package/lib/typescript/commonjs/utils/carousel-math.d.ts.map +1 -1
  32. package/lib/typescript/module/components/ItemLayout.d.ts +2 -2
  33. package/lib/typescript/module/components/ItemLayout.d.ts.map +1 -1
  34. package/lib/typescript/module/components/ItemRenderer.d.ts +3 -3
  35. package/lib/typescript/module/components/ItemRenderer.d.ts.map +1 -1
  36. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts +4 -4
  37. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts.map +1 -1
  38. package/lib/typescript/module/hooks/useCarouselController.d.ts +3 -3
  39. package/lib/typescript/module/hooks/useCarouselController.d.ts.map +1 -1
  40. package/lib/typescript/module/hooks/useOffsetX.d.ts +3 -3
  41. package/lib/typescript/module/hooks/useOffsetX.d.ts.map +1 -1
  42. package/lib/typescript/module/hooks/useOnProgressChange.d.ts +2 -2
  43. package/lib/typescript/module/hooks/useOnProgressChange.d.ts.map +1 -1
  44. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts +2 -2
  45. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts.map +1 -1
  46. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts +1 -1
  47. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts.map +1 -1
  48. package/lib/typescript/module/hooks/useVisibleRanges.d.ts +4 -4
  49. package/lib/typescript/module/hooks/useVisibleRanges.d.ts.map +1 -1
  50. package/lib/typescript/module/layouts/normal.d.ts +2 -2
  51. package/lib/typescript/module/layouts/parallax.d.ts +6 -6
  52. package/lib/typescript/module/public-types.d.ts +11 -1
  53. package/lib/typescript/module/public-types.d.ts.map +1 -1
  54. package/lib/typescript/module/utils/carousel-math.d.ts +1 -1
  55. package/lib/typescript/module/utils/carousel-math.d.ts.map +1 -1
  56. package/package.json +2 -2
  57. package/src/components/ItemLayout.tsx +2 -2
  58. package/src/components/ItemRenderer.tsx +3 -3
  59. package/src/components/Pagination/PaginationItem.tsx +9 -5
  60. package/src/hooks/useCarouselController.tsx +3 -3
  61. package/src/hooks/useOffsetX.ts +3 -3
  62. package/src/hooks/useOnProgressChange.ts +2 -2
  63. package/src/hooks/usePanGestureProxy.ts +7 -7
  64. package/src/hooks/useUpdateGestureConfig.ts +1 -1
  65. package/src/hooks/useVisibleRanges.tsx +4 -4
  66. package/src/public-types.ts +11 -0
  67. package/src/utils/carousel-math.ts +1 -1
  68. package/src/utils/computed-with-auto-fill-data.ts +2 -2
@@ -11,14 +11,14 @@ import type { GestureConfig } from "./useUpdateGestureConfig";
11
11
  import { useUpdateGestureConfig } from "./useUpdateGestureConfig";
12
12
 
13
13
  export const usePanGestureProxy = (customization: {
14
- onConfigurePanGesture?: (gesture: CarouselPanGesture) => void;
14
+ onConfigurePanGesture?: ((gesture: CarouselPanGesture) => void) | undefined;
15
15
  onGestureStart: (event: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => void;
16
16
  onGestureUpdate: (event: GestureUpdateEvent<PanGestureHandlerEventPayload>) => void;
17
17
  onGestureEnd: (
18
18
  event: GestureStateChangeEvent<PanGestureHandlerEventPayload>,
19
19
  success: boolean
20
20
  ) => void;
21
- options?: GestureConfig;
21
+ options?: GestureConfig | undefined;
22
22
  }) => {
23
23
  const {
24
24
  onConfigurePanGesture,
@@ -42,11 +42,11 @@ export const usePanGestureProxy = (customization: {
42
42
 
43
43
  // Save the user defined gesture callbacks
44
44
  const userDefinedConflictGestures: {
45
- onBegin?: Parameters<(typeof gesture)["onBegin"]>[0];
46
- onStart?: Parameters<(typeof gesture)["onStart"]>[0];
47
- onUpdate?: Parameters<(typeof gesture)["onUpdate"]>[0];
48
- onEnd?: Parameters<(typeof gesture)["onEnd"]>[0];
49
- onFinalize?: Parameters<(typeof gesture)["onFinalize"]>[0];
45
+ onBegin: Parameters<(typeof gesture)["onBegin"]>[0] | undefined;
46
+ onStart: Parameters<(typeof gesture)["onStart"]>[0] | undefined;
47
+ onUpdate: Parameters<(typeof gesture)["onUpdate"]>[0] | undefined;
48
+ onEnd: Parameters<(typeof gesture)["onEnd"]>[0] | undefined;
49
+ onFinalize: Parameters<(typeof gesture)["onFinalize"]>[0] | undefined;
50
50
  } = {
51
51
  onBegin: undefined,
52
52
  onStart: undefined,
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from "react";
2
2
 
3
3
  export interface GestureConfig {
4
- enabled?: boolean;
4
+ enabled?: boolean | undefined;
5
5
  }
6
6
 
7
7
  type ConfigurablePanGesture = {
@@ -27,9 +27,9 @@ function normalizeLoopIndex(currentIndex: number, total: number) {
27
27
 
28
28
  export function computeVisibleRanges(params: {
29
29
  total: number;
30
- windowSize?: number;
30
+ windowSize?: number | undefined;
31
31
  currentIndex: number;
32
- loop?: boolean;
32
+ loop?: boolean | undefined;
33
33
  }): VisibleRanges {
34
34
  "worklet";
35
35
 
@@ -91,9 +91,9 @@ export function computeVisibleRanges(params: {
91
91
  export function useVisibleRanges(options: {
92
92
  total: number;
93
93
  viewSize: number;
94
- windowSize?: number;
94
+ windowSize?: number | undefined;
95
95
  translation: SharedValue<number>;
96
- loop?: boolean;
96
+ loop?: boolean | undefined;
97
97
  }): VisibleRangesValue {
98
98
  const { total = 0, viewSize, translation, windowSize: _windowSize, loop } = options;
99
99
 
@@ -5,6 +5,7 @@ import type {
5
5
  GestureType,
6
6
  GestureUpdateEvent,
7
7
  MouseButton,
8
+ PanGesture,
8
9
  PanGestureChangeEventPayload,
9
10
  PanGestureHandlerEventPayload,
10
11
  PanGestureHandlerProps,
@@ -148,6 +149,16 @@ export type CarouselItemAnimation = (relativeProgress: number, index: number) =>
148
149
  * methods such as `enabled`, `runOnJS`, or `manualActivation`.
149
150
  */
150
151
  export interface CarouselPanGesture {
152
+ /**
153
+ * Controlled view of the underlying RNGH pan gesture configuration.
154
+ *
155
+ * Exposes the web-only `touchAction` option (e.g. `"pan-y"` so a
156
+ * horizontal carousel nested in a vertically scrollable page keeps native
157
+ * vertical scrolling on mobile web) without casting away the facade.
158
+ * Ownership-changing options such as `enabled`, `runOnJS`, or
159
+ * `manualActivation` intentionally stay hidden.
160
+ */
161
+ readonly config: Pick<PanGesture["config"], "touchAction">;
151
162
  activeOffsetX(offset: number | [start: number, end: number]): this;
152
163
  activeOffsetY(offset: number | [start: number, end: number]): this;
153
164
  failOffsetX(offset: number | [start: number, end: number]): this;
@@ -127,7 +127,7 @@ export function reconcileOffsetAfterDataChange(params: {
127
127
  nextCount: number;
128
128
  defaultIndex: number;
129
129
  loop: boolean;
130
- retainedIndex?: number;
130
+ retainedIndex?: number | undefined;
131
131
  }): number {
132
132
  "worklet";
133
133
 
@@ -82,9 +82,9 @@ export function computedFillDataWithAutoFillData<T>(
82
82
  if (isAutoFillData({ loop, autoFillData })) {
83
83
  switch (dataLength) {
84
84
  case SINGLE_ITEM:
85
- return [data[0], data[0], data[0]];
85
+ return [data[0]!, data[0]!, data[0]!];
86
86
  case DOUBLE_ITEM:
87
- return [data[0], data[1], data[0], data[1]];
87
+ return [data[0]!, data[1]!, data[0]!, data[1]!];
88
88
  }
89
89
  }
90
90