@fountain-ui/lab 2.0.0-beta.16 → 2.0.0-beta.19

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 (58) hide show
  1. package/build/commonjs/Carousel/Carousel.js +11 -20
  2. package/build/commonjs/Carousel/Carousel.js.map +1 -1
  3. package/build/commonjs/Carousel/CarouselProps.js.map +1 -1
  4. package/build/commonjs/Carousel/components/ItemView.js +2 -2
  5. package/build/commonjs/Carousel/components/ItemView.js.map +1 -1
  6. package/build/commonjs/Carousel/components/ScrollViewGesture.js +4 -3
  7. package/build/commonjs/Carousel/components/ScrollViewGesture.js.map +1 -1
  8. package/build/commonjs/Carousel/hooks/index.js +3 -3
  9. package/build/commonjs/Carousel/hooks/index.js.map +1 -1
  10. package/build/commonjs/Carousel/hooks/useIndexController.js +28 -21
  11. package/build/commonjs/Carousel/hooks/useIndexController.js.map +1 -1
  12. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js +3 -3
  13. package/build/commonjs/Carousel/hooks/useItemVisibilityStore.js.map +1 -1
  14. package/build/commonjs/Carousel/hooks/{usePagingAnimation.js → usePagingAnimator.js} +44 -22
  15. package/build/commonjs/Carousel/hooks/usePagingAnimator.js.map +1 -0
  16. package/build/commonjs/Carousel/types.js +1 -1
  17. package/build/commonjs/Carousel/types.js.map +1 -1
  18. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js +1 -1
  19. package/build/commonjs/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  20. package/build/module/Carousel/Carousel.js +13 -19
  21. package/build/module/Carousel/Carousel.js.map +1 -1
  22. package/build/module/Carousel/CarouselProps.js.map +1 -1
  23. package/build/module/Carousel/components/ItemView.js +2 -2
  24. package/build/module/Carousel/components/ItemView.js.map +1 -1
  25. package/build/module/Carousel/components/ScrollViewGesture.js +4 -3
  26. package/build/module/Carousel/components/ScrollViewGesture.js.map +1 -1
  27. package/build/module/Carousel/hooks/index.js +1 -1
  28. package/build/module/Carousel/hooks/index.js.map +1 -1
  29. package/build/module/Carousel/hooks/useIndexController.js +28 -22
  30. package/build/module/Carousel/hooks/useIndexController.js.map +1 -1
  31. package/build/module/Carousel/hooks/useItemVisibilityStore.js +3 -3
  32. package/build/module/Carousel/hooks/useItemVisibilityStore.js.map +1 -1
  33. package/build/module/Carousel/hooks/{usePagingAnimation.js → usePagingAnimator.js} +43 -22
  34. package/build/module/Carousel/hooks/usePagingAnimator.js.map +1 -0
  35. package/build/module/Carousel/types.js +1 -1
  36. package/build/module/Carousel/types.js.map +1 -1
  37. package/build/module/ViewPager/ChildrenMemoizedPage.js +1 -1
  38. package/build/module/ViewPager/ChildrenMemoizedPage.js.map +1 -1
  39. package/build/typescript/Carousel/CarouselProps.d.ts +2 -2
  40. package/build/typescript/Carousel/components/ScrollViewGesture.d.ts +1 -1
  41. package/build/typescript/Carousel/hooks/index.d.ts +1 -1
  42. package/build/typescript/Carousel/hooks/useIndexController.d.ts +3 -1
  43. package/build/typescript/Carousel/hooks/useItemVisibilityStore.d.ts +2 -5
  44. package/build/typescript/Carousel/hooks/{usePagingAnimation.d.ts → usePagingAnimator.d.ts} +6 -5
  45. package/build/typescript/Carousel/types.d.ts +14 -4
  46. package/package.json +2 -2
  47. package/src/Carousel/Carousel.tsx +12 -20
  48. package/src/Carousel/CarouselProps.ts +9 -2
  49. package/src/Carousel/components/ItemView.tsx +2 -2
  50. package/src/Carousel/components/ScrollViewGesture.tsx +8 -4
  51. package/src/Carousel/hooks/index.ts +1 -1
  52. package/src/Carousel/hooks/useIndexController.tsx +29 -26
  53. package/src/Carousel/hooks/useItemVisibilityStore.ts +5 -9
  54. package/src/Carousel/hooks/{usePagingAnimation.ts → usePagingAnimator.ts} +48 -29
  55. package/src/Carousel/types.ts +17 -4
  56. package/src/ViewPager/ChildrenMemoizedPage.tsx +1 -1
  57. package/build/commonjs/Carousel/hooks/usePagingAnimation.js.map +0 -1
  58. package/build/module/Carousel/hooks/usePagingAnimation.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { useCallback, useRef } from 'react';
1
+ import { useCallback, useMemo, useRef } from 'react';
2
2
  import { Animated } from 'react-native';
3
3
  import type {
4
4
  CreateScrollAnimation,
@@ -11,17 +11,18 @@ import type {
11
11
  StartPagingAnimation,
12
12
  } from '../types';
13
13
 
14
- export interface PagingAnimationParameters {
14
+ export interface PagingAnimatorConfig {
15
15
  createScrollAnimation: CreateScrollAnimation;
16
16
  itemWidth: number;
17
17
  indexController: IndexController;
18
+ initialIndex: number;
18
19
  loop: boolean;
19
20
  numberOfData: number;
20
- offsetX: Animated.Value;
21
- translateX: Animated.Value;
22
21
  }
23
22
 
24
- export interface UsePagingAnimation {
23
+ export interface PagingAnimator {
24
+ gestureTranslationX: Animated.Value;
25
+ globalInterpolation: Animated.AnimatedInterpolation;
25
26
  interruptAnimation: () => void;
26
27
  startPagingAnimation: StartPagingAnimation;
27
28
  }
@@ -54,24 +55,34 @@ function toValueCompensator(itemWidth: number) {
54
55
  };
55
56
  }
56
57
 
57
- export default function usePagingAnimation(params: PagingAnimationParameters): UsePagingAnimation {
58
+ export default function usePagingAnimator(config: PagingAnimatorConfig): PagingAnimator {
58
59
  const {
59
60
  createScrollAnimation,
60
61
  itemWidth,
61
62
  indexController,
63
+ initialIndex,
62
64
  loop,
63
65
  numberOfData,
64
- offsetX,
65
- translateX,
66
- } = params;
66
+ } = config;
67
67
 
68
68
  const {
69
69
  getCurrentIndex,
70
70
  lastIndex,
71
- notifyAnimationState,
72
- notifyOffsetHasChanged,
71
+ notifyScrollStateHasChanged,
73
72
  } = indexController;
74
73
 
74
+ const initialOffsetX = itemWidth * initialIndex;
75
+ const accumulativeOffsetX = useRef(new Animated.Value(initialOffsetX)).current;
76
+ const animationOffsetX = useRef(new Animated.Value(0)).current;
77
+ const gestureTranslationX = useRef(new Animated.Value(0)).current;
78
+
79
+ const globalInterpolation = useMemo(() => {
80
+ return Animated.add(
81
+ Animated.add(accumulativeOffsetX, animationOffsetX),
82
+ gestureTranslationX,
83
+ );
84
+ }, []);
85
+
75
86
  const toValueRef = useRef<number>(0);
76
87
  const currentOffsetRef = useRef<number>(0);
77
88
 
@@ -95,14 +106,12 @@ export default function usePagingAnimation(params: PagingAnimationParameters): U
95
106
  const nextOffset = ensureOffsetBoundary(newOffset);
96
107
 
97
108
  currentOffsetRef.current = nextOffset;
98
- offsetX.setValue(nextOffset);
109
+ accumulativeOffsetX.setValue(nextOffset);
99
110
 
100
111
  toValueRef.current = 0;
101
- translateX.setValue(0);
112
+ animationOffsetX.setValue(0);
102
113
  }, [
103
114
  ensureOffsetBoundary,
104
- offsetX,
105
- translateX,
106
115
  ]);
107
116
 
108
117
  const interruptAnimation = useCallback(() => {
@@ -110,22 +119,22 @@ export default function usePagingAnimation(params: PagingAnimationParameters): U
110
119
  return;
111
120
  }
112
121
 
113
- translateX.stopAnimation(lastValue => {
122
+ animationOffsetX.stopAnimation(lastValue => {
114
123
  isAnimatingRef.current = false;
115
124
 
116
125
  const prevOffset = currentOffsetRef.current;
117
126
  const totalOffset = prevOffset + lastValue;
118
127
 
119
- notifyOffsetHasChanged(totalOffset);
120
- notifyAnimationState('interrupted');
121
-
122
128
  requireNewOffset(totalOffset);
129
+
130
+ notifyScrollStateHasChanged({ offset: totalOffset, state: 'interrupted' });
123
131
  });
124
- }, [requireNewOffset, translateX]);
132
+ }, [
133
+ notifyScrollStateHasChanged,
134
+ requireNewOffset,
135
+ ]);
125
136
 
126
137
  const finalizeAnimation = useCallback(() => {
127
- notifyAnimationState('finished');
128
-
129
138
  isAnimatingRef.current = false;
130
139
 
131
140
  const prevOffset = currentOffsetRef.current;
@@ -133,8 +142,10 @@ export default function usePagingAnimation(params: PagingAnimationParameters): U
133
142
  const totalOffset = prevOffset + toValue;
134
143
 
135
144
  requireNewOffset(totalOffset);
145
+
146
+ notifyScrollStateHasChanged({ offset: totalOffset, state: 'idle' });
136
147
  }, [
137
- notifyAnimationState,
148
+ notifyScrollStateHasChanged,
138
149
  requireNewOffset,
139
150
  ]);
140
151
 
@@ -202,18 +213,25 @@ export default function usePagingAnimation(params: PagingAnimationParameters): U
202
213
  toValueRef.current = toValue;
203
214
  isAnimatingRef.current = true;
204
215
 
205
- notifyOffsetHasChanged(currentOffsetRef.current + toValue);
216
+ notifyScrollStateHasChanged({
217
+ offset: currentOffsetRef.current + toValue,
218
+ state: 'dragging',
219
+ });
220
+
221
+ const lastGestureTranslationX: number = configWithDefaults.lastGestureTranslationX ?? 0;
222
+ if (Number.isFinite(lastGestureTranslationX)) {
223
+ animationOffsetX.setValue(lastGestureTranslationX);
224
+ gestureTranslationX.setValue(0);
225
+ }
206
226
 
207
227
  if (configWithDefaults.animated) {
208
- const animation = createScrollAnimation(translateX, toValue);
228
+ const animation = createScrollAnimation(animationOffsetX, toValue);
209
229
 
210
230
  animation.start(({ finished }) => {
211
231
  if (finished) {
212
232
  finalizeAnimation();
213
233
  }
214
234
  });
215
-
216
- notifyAnimationState('started');
217
235
  } else {
218
236
  finalizeAnimation();
219
237
  }
@@ -224,11 +242,12 @@ export default function usePagingAnimation(params: PagingAnimationParameters): U
224
242
  itemWidth,
225
243
  lastIndex,
226
244
  loop,
227
- notifyAnimationState,
228
- notifyOffsetHasChanged,
245
+ notifyScrollStateHasChanged,
229
246
  ]);
230
247
 
231
248
  return {
249
+ gestureTranslationX,
250
+ globalInterpolation,
232
251
  interruptAnimation,
233
252
  startPagingAnimation,
234
253
  };
@@ -5,9 +5,9 @@ const directions = ['next', 'prev', 'stay'] as const;
5
5
 
6
6
  export type PagingDirection = (typeof directions)[number];
7
7
 
8
- const animationStates = ['started', 'finished', 'interrupted'] as const;
8
+ const scrollStates = ['idle', 'dragging', 'interrupted'] as const;
9
9
 
10
- export type AnimationState = (typeof animationStates)[number];
10
+ export type ScrollState = (typeof scrollStates)[number];
11
11
 
12
12
  export type ItemHeight = number | 'auto';
13
13
 
@@ -27,17 +27,30 @@ export interface GetCurrentIndex {
27
27
  (): number;
28
28
  }
29
29
 
30
+ export interface OnIndexChange {
31
+ (itemIndex: number): void;
32
+ }
33
+
34
+ export interface OnPositionChange {
35
+ (position: number): void;
36
+ }
37
+
38
+ export interface ScrollStateChangeEvent {
39
+ offset: number;
40
+ state: ScrollState;
41
+ }
42
+
30
43
  export interface IndexController {
31
44
  getCurrentIndex: GetCurrentIndex;
32
45
  lastIndex: number;
33
- notifyAnimationState: (state: AnimationState) => void;
34
- notifyOffsetHasChanged: (offset: number) => void;
46
+ notifyScrollStateHasChanged: (event: ScrollStateChangeEvent) => void;
35
47
  }
36
48
 
37
49
  export type PagingAnimationType = 'directional' | 'index';
38
50
 
39
51
  export interface BasePagingAnimationConfig {
40
52
  animated?: boolean;
53
+ lastGestureTranslationX?: number;
41
54
  }
42
55
 
43
56
  export interface DirectionalPagingAnimationConfig extends BasePagingAnimationConfig {
@@ -109,5 +109,5 @@ export default memo(Page, (prevProps, nextProps) => {
109
109
  return false;
110
110
  }
111
111
 
112
- return prevProps.index !== nextProps.index;
112
+ return prevProps.index === nextProps.index;
113
113
  });
@@ -1 +0,0 @@
1
- {"version":3,"names":["directionToValue","itemWidth","direction","toValueCompensator","toValue","currentOffset","remainder","Math","abs","halfOfItemWidth","compensateVector","usePagingAnimation","params","createScrollAnimation","indexController","loop","numberOfData","offsetX","translateX","getCurrentIndex","lastIndex","notifyAnimationState","notifyOffsetHasChanged","toValueRef","useRef","currentOffsetRef","isAnimatingRef","maxWidth","ensureOffsetBoundary","useCallback","offset","isCloseToEnd","signOfOffset","requireNewOffset","newOffset","nextOffset","current","setValue","interruptAnimation","stopAnimation","lastValue","prevOffset","totalOffset","finalizeAnimation","startPagingAnimation","type","config","configWithDefaults","animated","currentIndex","getValueByDirectionOnAllAdjacentItemsVisible","compensateToValue","getValueByDirectionalPagingOnLoopDisabled","_config","isOriginatedFromGesture","getValueByDirectionalPaging","_configWithDefaults","getValueByIndexPaging","index","distance","wantedToValue","animation","start","finished"],"sources":["usePagingAnimation.ts"],"sourcesContent":["import { useCallback, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport type {\n CreateScrollAnimation,\n DirectionalPagingAnimationConfig,\n IndexController,\n IndexPagingAnimationConfig,\n PagingAnimationConfig,\n PagingAnimationType,\n PagingDirection,\n StartPagingAnimation,\n} from '../types';\n\nexport interface PagingAnimationParameters {\n createScrollAnimation: CreateScrollAnimation;\n itemWidth: number;\n indexController: IndexController;\n loop: boolean;\n numberOfData: number;\n offsetX: Animated.Value;\n translateX: Animated.Value;\n}\n\nexport interface UsePagingAnimation {\n interruptAnimation: () => void;\n startPagingAnimation: StartPagingAnimation;\n}\n\nfunction directionToValue(itemWidth: number) {\n return function (direction: PagingDirection): number {\n switch (direction) {\n case 'next':\n return -itemWidth;\n case 'prev':\n return itemWidth;\n case 'stay':\n return 0;\n }\n };\n}\n\nfunction toValueCompensator(itemWidth: number) {\n return function (toValue: number, currentOffset: number): number {\n const remainder = Math.abs(currentOffset % itemWidth);\n\n const halfOfItemWidth = Math.abs(itemWidth / 2);\n const compensateVector = remainder > halfOfItemWidth\n ? remainder - itemWidth\n : remainder;\n\n const direction = currentOffset > 0 ? -1 : 1;\n\n return toValue + (direction * compensateVector);\n };\n}\n\nexport default function usePagingAnimation(params: PagingAnimationParameters): UsePagingAnimation {\n const {\n createScrollAnimation,\n itemWidth,\n indexController,\n loop,\n numberOfData,\n offsetX,\n translateX,\n } = params;\n\n const {\n getCurrentIndex,\n lastIndex,\n notifyAnimationState,\n notifyOffsetHasChanged,\n } = indexController;\n\n const toValueRef = useRef<number>(0);\n const currentOffsetRef = useRef<number>(0);\n\n const isAnimatingRef = useRef<boolean>(false);\n\n const maxWidth = Math.abs(numberOfData * itemWidth);\n\n const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {\n if (loop) {\n const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);\n if (isCloseToEnd) {\n const signOfOffset = offset > 0 ? 1 : -1;\n return offset + (-signOfOffset * maxWidth);\n }\n }\n\n return offset % maxWidth;\n }, [itemWidth, loop, maxWidth]);\n\n const requireNewOffset = useCallback((newOffset: number) => {\n const nextOffset = ensureOffsetBoundary(newOffset);\n\n currentOffsetRef.current = nextOffset;\n offsetX.setValue(nextOffset);\n\n toValueRef.current = 0;\n translateX.setValue(0);\n }, [\n ensureOffsetBoundary,\n offsetX,\n translateX,\n ]);\n\n const interruptAnimation = useCallback(() => {\n if (!isAnimatingRef.current) {\n return;\n }\n\n translateX.stopAnimation(lastValue => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const totalOffset = prevOffset + lastValue;\n\n notifyOffsetHasChanged(totalOffset);\n notifyAnimationState('interrupted');\n\n requireNewOffset(totalOffset);\n });\n }, [requireNewOffset, translateX]);\n\n const finalizeAnimation = useCallback(() => {\n notifyAnimationState('finished');\n\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const toValue = toValueRef.current;\n const totalOffset = prevOffset + toValue;\n\n requireNewOffset(totalOffset);\n }, [\n notifyAnimationState,\n requireNewOffset,\n ]);\n\n const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {\n if (isAnimatingRef.current) {\n return;\n }\n\n const configWithDefaults: PagingAnimationConfig = {\n animated: true,\n ...config,\n };\n\n const currentIndex = getCurrentIndex();\n\n const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);\n const compensateToValue = toValueCompensator(itemWidth);\n\n const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {\n const { direction, isOriginatedFromGesture } = _config;\n\n if (currentIndex === 0 && direction === 'prev') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : -lastIndex * itemWidth; // last position\n } else if (currentIndex === lastIndex && direction === 'next') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : lastIndex * itemWidth; // first position\n }\n return getValueByDirectionOnAllAdjacentItemsVisible(direction);\n };\n\n const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {\n const _configWithDefaults: DirectionalPagingAnimationConfig = {\n isOriginatedFromGesture: false,\n ..._config,\n };\n\n return loop\n ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)\n : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);\n };\n\n const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {\n if (index < 0 || index > lastIndex || index === currentIndex) {\n // no animation if index is invalid or equals to current index\n return 0;\n }\n\n const distance = Math.abs(currentIndex - index) * itemWidth;\n const direction = index > currentIndex ? -1 : 1;\n\n return distance * direction;\n };\n\n const wantedToValue = type === 'directional'\n // @ts-ignore\n ? getValueByDirectionalPaging(configWithDefaults)\n // @ts-ignore\n : getValueByIndexPaging(configWithDefaults);\n\n const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);\n\n toValueRef.current = toValue;\n isAnimatingRef.current = true;\n\n notifyOffsetHasChanged(currentOffsetRef.current + toValue);\n\n if (configWithDefaults.animated) {\n const animation = createScrollAnimation(translateX, toValue);\n\n animation.start(({ finished }) => {\n if (finished) {\n finalizeAnimation();\n }\n });\n\n notifyAnimationState('started');\n } else {\n finalizeAnimation();\n }\n }, [\n createScrollAnimation,\n getCurrentIndex,\n finalizeAnimation,\n itemWidth,\n lastIndex,\n loop,\n notifyAnimationState,\n notifyOffsetHasChanged,\n ]);\n\n return {\n interruptAnimation,\n startPagingAnimation,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AA4BA,SAASA,gBAAT,CAA0BC,SAA1B,EAA6C;EACzC,OAAO,UAAUC,SAAV,EAA8C;IACjD,QAAQA,SAAR;MACI,KAAK,MAAL;QACI,OAAO,CAACD,SAAR;;MACJ,KAAK,MAAL;QACI,OAAOA,SAAP;;MACJ,KAAK,MAAL;QACI,OAAO,CAAP;IANR;EAQH,CATD;AAUH;;AAED,SAASE,kBAAT,CAA4BF,SAA5B,EAA+C;EAC3C,OAAO,UAAUG,OAAV,EAA2BC,aAA3B,E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CM,oBAPD,EAQCC,sBARD,CA/E0B,CAA7B;EA0FA,OAAO;IACHgB,kBADG;IAEHM;EAFG,CAAP;AAIH;;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["useCallback","useRef","directionToValue","itemWidth","direction","toValueCompensator","toValue","currentOffset","remainder","Math","abs","halfOfItemWidth","compensateVector","usePagingAnimation","params","createScrollAnimation","indexController","loop","numberOfData","offsetX","translateX","getCurrentIndex","lastIndex","notifyAnimationState","notifyOffsetHasChanged","toValueRef","currentOffsetRef","isAnimatingRef","maxWidth","ensureOffsetBoundary","offset","isCloseToEnd","signOfOffset","requireNewOffset","newOffset","nextOffset","current","setValue","interruptAnimation","stopAnimation","lastValue","prevOffset","totalOffset","finalizeAnimation","startPagingAnimation","type","config","configWithDefaults","animated","currentIndex","getValueByDirectionOnAllAdjacentItemsVisible","compensateToValue","getValueByDirectionalPagingOnLoopDisabled","_config","isOriginatedFromGesture","getValueByDirectionalPaging","_configWithDefaults","getValueByIndexPaging","index","distance","wantedToValue","animation","start","finished"],"sources":["usePagingAnimation.ts"],"sourcesContent":["import { useCallback, useRef } from 'react';\nimport { Animated } from 'react-native';\nimport type {\n CreateScrollAnimation,\n DirectionalPagingAnimationConfig,\n IndexController,\n IndexPagingAnimationConfig,\n PagingAnimationConfig,\n PagingAnimationType,\n PagingDirection,\n StartPagingAnimation,\n} from '../types';\n\nexport interface PagingAnimationParameters {\n createScrollAnimation: CreateScrollAnimation;\n itemWidth: number;\n indexController: IndexController;\n loop: boolean;\n numberOfData: number;\n offsetX: Animated.Value;\n translateX: Animated.Value;\n}\n\nexport interface UsePagingAnimation {\n interruptAnimation: () => void;\n startPagingAnimation: StartPagingAnimation;\n}\n\nfunction directionToValue(itemWidth: number) {\n return function (direction: PagingDirection): number {\n switch (direction) {\n case 'next':\n return -itemWidth;\n case 'prev':\n return itemWidth;\n case 'stay':\n return 0;\n }\n };\n}\n\nfunction toValueCompensator(itemWidth: number) {\n return function (toValue: number, currentOffset: number): number {\n const remainder = Math.abs(currentOffset % itemWidth);\n\n const halfOfItemWidth = Math.abs(itemWidth / 2);\n const compensateVector = remainder > halfOfItemWidth\n ? remainder - itemWidth\n : remainder;\n\n const direction = currentOffset > 0 ? -1 : 1;\n\n return toValue + (direction * compensateVector);\n };\n}\n\nexport default function usePagingAnimation(params: PagingAnimationParameters): UsePagingAnimation {\n const {\n createScrollAnimation,\n itemWidth,\n indexController,\n loop,\n numberOfData,\n offsetX,\n translateX,\n } = params;\n\n const {\n getCurrentIndex,\n lastIndex,\n notifyAnimationState,\n notifyOffsetHasChanged,\n } = indexController;\n\n const toValueRef = useRef<number>(0);\n const currentOffsetRef = useRef<number>(0);\n\n const isAnimatingRef = useRef<boolean>(false);\n\n const maxWidth = Math.abs(numberOfData * itemWidth);\n\n const ensureOffsetBoundary: (offset: number) => number = useCallback((offset: number) => {\n if (loop) {\n const isCloseToEnd = Math.abs(offset) >= (maxWidth - itemWidth);\n if (isCloseToEnd) {\n const signOfOffset = offset > 0 ? 1 : -1;\n return offset + (-signOfOffset * maxWidth);\n }\n }\n\n return offset % maxWidth;\n }, [itemWidth, loop, maxWidth]);\n\n const requireNewOffset = useCallback((newOffset: number) => {\n const nextOffset = ensureOffsetBoundary(newOffset);\n\n currentOffsetRef.current = nextOffset;\n offsetX.setValue(nextOffset);\n\n toValueRef.current = 0;\n translateX.setValue(0);\n }, [\n ensureOffsetBoundary,\n offsetX,\n translateX,\n ]);\n\n const interruptAnimation = useCallback(() => {\n if (!isAnimatingRef.current) {\n return;\n }\n\n translateX.stopAnimation(lastValue => {\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const totalOffset = prevOffset + lastValue;\n\n notifyOffsetHasChanged(totalOffset);\n notifyAnimationState('interrupted');\n\n requireNewOffset(totalOffset);\n });\n }, [requireNewOffset, translateX]);\n\n const finalizeAnimation = useCallback(() => {\n notifyAnimationState('finished');\n\n isAnimatingRef.current = false;\n\n const prevOffset = currentOffsetRef.current;\n const toValue = toValueRef.current;\n const totalOffset = prevOffset + toValue;\n\n requireNewOffset(totalOffset);\n }, [\n notifyAnimationState,\n requireNewOffset,\n ]);\n\n const startPagingAnimation = useCallback((type: PagingAnimationType, config: PagingAnimationConfig) => {\n if (isAnimatingRef.current) {\n return;\n }\n\n const configWithDefaults: PagingAnimationConfig = {\n animated: true,\n ...config,\n };\n\n const currentIndex = getCurrentIndex();\n\n const getValueByDirectionOnAllAdjacentItemsVisible = directionToValue(itemWidth);\n const compensateToValue = toValueCompensator(itemWidth);\n\n const getValueByDirectionalPagingOnLoopDisabled = (_config: DirectionalPagingAnimationConfig): number => {\n const { direction, isOriginatedFromGesture } = _config;\n\n if (currentIndex === 0 && direction === 'prev') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : -lastIndex * itemWidth; // last position\n } else if (currentIndex === lastIndex && direction === 'next') {\n return isOriginatedFromGesture\n ? getValueByDirectionOnAllAdjacentItemsVisible('stay')\n : lastIndex * itemWidth; // first position\n }\n return getValueByDirectionOnAllAdjacentItemsVisible(direction);\n };\n\n const getValueByDirectionalPaging = (_config: DirectionalPagingAnimationConfig): number => {\n const _configWithDefaults: DirectionalPagingAnimationConfig = {\n isOriginatedFromGesture: false,\n ..._config,\n };\n\n return loop\n ? getValueByDirectionOnAllAdjacentItemsVisible(_configWithDefaults.direction)\n : getValueByDirectionalPagingOnLoopDisabled(_configWithDefaults);\n };\n\n const getValueByIndexPaging = ({ index }: IndexPagingAnimationConfig): number => {\n if (index < 0 || index > lastIndex || index === currentIndex) {\n // no animation if index is invalid or equals to current index\n return 0;\n }\n\n const distance = Math.abs(currentIndex - index) * itemWidth;\n const direction = index > currentIndex ? -1 : 1;\n\n return distance * direction;\n };\n\n const wantedToValue = type === 'directional'\n // @ts-ignore\n ? getValueByDirectionalPaging(configWithDefaults)\n // @ts-ignore\n : getValueByIndexPaging(configWithDefaults);\n\n const toValue = compensateToValue(wantedToValue, currentOffsetRef.current);\n\n toValueRef.current = toValue;\n isAnimatingRef.current = true;\n\n notifyOffsetHasChanged(currentOffsetRef.current + toValue);\n\n if (configWithDefaults.animated) {\n const animation = createScrollAnimation(translateX, toValue);\n\n animation.start(({ finished }) => {\n if (finished) {\n finalizeAnimation();\n }\n });\n\n notifyAnimationState('started');\n } else {\n finalizeAnimation();\n }\n }, [\n createScrollAnimation,\n getCurrentIndex,\n finalizeAnimation,\n itemWidth,\n lastIndex,\n loop,\n notifyAnimationState,\n notifyOffsetHasChanged,\n ]);\n\n return {\n interruptAnimation,\n startPagingAnimation,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,MAAtB,QAAoC,OAApC;;AA4BA,SAASC,gBAAT,CAA0BC,SAA1B,EAA6C;EACzC,OAAO,UAAUC,SAAV,EAA8C;IACjD,QAAQA,SAAR;MACI,KAAK,MAAL;QACI,OAAO,CAACD,SAAR;;MACJ,KAAK,MAAL;QACI,OAAOA,SAAP;;MACJ,KAAK,MAAL;QACI,OAAO,CAAP;IANR;EAQH,CATD;AAUH;;AAED,SAASE,kBAAT,CAA4BF,SAA5B,EAA+C;EAC3C,OAAO,UAAUG,OAAV,EAA2BC,aAA3B,EAA0D;IAC7D,MAAMC,SAAS,GAAGC,IAAI,CAACC,GAAL,CAASH,aAAa,GAAGJ,SAAzB,CAAlB;IAEA,MAAMQ,eAAe,GAAGF,IAAI,CAACC,GAAL,CAASP,SAAS,GAAG,CAArB,CAAxB;IACA,MAAMS,gBAAgB,GAAGJ,SAAS,GAAGG,eAAZ,GACnBH,SAAS,GAAGL,SADO,GAEnBK,SAFN;IAIA,MAAMJ,SAAS,GAAGG,aAAa,GAAG,CAAhB,GAAoB,CAAC,CAArB,GAAyB,CAA3C;IAEA,OAAOD,OAAO,GAAIF,SAAS,GAAGQ,gBAA9B;EACH,CAXD;AAYH;;AAED,eAAe,SAASC,kBAAT,CAA4BC,MAA5B,EAAmF;EAC9F,MAAM;IACFC,qBADE;IAEFZ,SAFE;IAGFa,eAHE;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