react-native-reanimated-carousel 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (173) hide show
  1. package/README.md +2 -3
  2. package/lib/commonjs/{layouts → components}/BaseLayout.js +5 -21
  3. package/lib/commonjs/components/BaseLayout.js.map +1 -0
  4. package/lib/commonjs/components/Carousel.js +28 -48
  5. package/lib/commonjs/components/Carousel.js.map +1 -1
  6. package/lib/commonjs/components/ItemRenderer.js +80 -0
  7. package/lib/commonjs/components/ItemRenderer.js.map +1 -0
  8. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +81 -0
  9. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +1 -0
  10. package/lib/commonjs/components/Pagination/Basic/index.js +57 -0
  11. package/lib/commonjs/components/Pagination/Basic/index.js.map +1 -0
  12. package/lib/commonjs/components/Pagination/index.js +14 -0
  13. package/lib/commonjs/components/Pagination/index.js.map +1 -0
  14. package/lib/commonjs/components/ScrollViewGesture.js +51 -33
  15. package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
  16. package/lib/commonjs/components/rnr-demo.test.js +45 -0
  17. package/lib/commonjs/components/rnr-demo.test.js.map +1 -0
  18. package/lib/commonjs/hooks/useCarouselController.js +12 -11
  19. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  20. package/lib/commonjs/hooks/useCommonVariables.js +38 -12
  21. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
  22. package/lib/commonjs/hooks/useCommonVariables.test.js +38 -0
  23. package/lib/commonjs/hooks/useCommonVariables.test.js.map +1 -0
  24. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  25. package/lib/commonjs/hooks/useOffsetX.js +9 -6
  26. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  27. package/lib/commonjs/hooks/useOffsetX.test.js +53 -0
  28. package/lib/commonjs/hooks/useOffsetX.test.js.map +1 -0
  29. package/lib/commonjs/hooks/useOnProgressChange.js +4 -1
  30. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  31. package/lib/commonjs/hooks/usePanGestureProxy.js +84 -0
  32. package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -0
  33. package/lib/commonjs/hooks/usePanGestureProxy.test.js +397 -0
  34. package/lib/commonjs/hooks/usePanGestureProxy.test.js.map +1 -0
  35. package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
  36. package/lib/commonjs/hooks/useVisibleRanges.js +48 -19
  37. package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
  38. package/lib/commonjs/hooks/useVisibleRanges.test.js +162 -0
  39. package/lib/commonjs/hooks/useVisibleRanges.test.js.map +1 -0
  40. package/lib/commonjs/index.js +8 -0
  41. package/lib/commonjs/index.js.map +1 -1
  42. package/lib/commonjs/utils/{computeNewIndexWhenDataChanges.js → compute-offset-if-data-changed.js} +3 -3
  43. package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +1 -0
  44. package/lib/commonjs/utils/compute-offset-if-data-changed.test.js +30 -0
  45. package/lib/commonjs/utils/compute-offset-if-data-changed.test.js.map +1 -0
  46. package/lib/commonjs/utils/compute-offset-if-size-changed.js +18 -0
  47. package/lib/commonjs/utils/compute-offset-if-size-changed.js.map +1 -0
  48. package/lib/commonjs/utils/compute-offset-if-size-changed.test.js +72 -0
  49. package/lib/commonjs/utils/compute-offset-if-size-changed.test.js.map +1 -0
  50. package/lib/commonjs/utils/handleroffset-direction.js +5 -5
  51. package/lib/commonjs/utils/handleroffset-direction.js.map +1 -1
  52. package/lib/commonjs/utils/handleroffset-direction.test.js +46 -0
  53. package/lib/commonjs/utils/handleroffset-direction.test.js.map +1 -0
  54. package/lib/commonjs/utils/index.test.js +6 -6
  55. package/lib/commonjs/utils/index.test.js.map +1 -1
  56. package/lib/module/{layouts → components}/BaseLayout.js +6 -16
  57. package/lib/module/components/BaseLayout.js.map +1 -0
  58. package/lib/module/components/Carousel.js +27 -44
  59. package/lib/module/components/Carousel.js.map +1 -1
  60. package/lib/module/components/ItemRenderer.js +62 -0
  61. package/lib/module/components/ItemRenderer.js.map +1 -0
  62. package/lib/module/components/Pagination/Basic/PaginationItem.js +63 -0
  63. package/lib/module/components/Pagination/Basic/PaginationItem.js.map +1 -0
  64. package/lib/module/components/Pagination/Basic/index.js +42 -0
  65. package/lib/module/components/Pagination/Basic/index.js.map +1 -0
  66. package/lib/module/components/Pagination/index.js +5 -0
  67. package/lib/module/components/Pagination/index.js.map +1 -0
  68. package/lib/module/components/ScrollViewGesture.js +53 -34
  69. package/lib/module/components/ScrollViewGesture.js.map +1 -1
  70. package/lib/module/components/rnr-demo.test.js +33 -0
  71. package/lib/module/components/rnr-demo.test.js.map +1 -0
  72. package/lib/module/hooks/useCarouselController.js +12 -11
  73. package/lib/module/hooks/useCarouselController.js.map +1 -1
  74. package/lib/module/hooks/useCommonVariables.js +38 -8
  75. package/lib/module/hooks/useCommonVariables.js.map +1 -1
  76. package/lib/module/hooks/useCommonVariables.test.js +34 -0
  77. package/lib/module/hooks/useCommonVariables.test.js.map +1 -0
  78. package/lib/module/hooks/useLayoutConfig.js.map +1 -1
  79. package/lib/module/hooks/useOffsetX.js +9 -6
  80. package/lib/module/hooks/useOffsetX.js.map +1 -1
  81. package/lib/module/hooks/useOffsetX.test.js +48 -0
  82. package/lib/module/hooks/useOffsetX.test.js.map +1 -0
  83. package/lib/module/hooks/useOnProgressChange.js +4 -1
  84. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  85. package/lib/module/hooks/usePanGestureProxy.js +71 -0
  86. package/lib/module/hooks/usePanGestureProxy.js.map +1 -0
  87. package/lib/module/hooks/usePanGestureProxy.test.js +383 -0
  88. package/lib/module/hooks/usePanGestureProxy.test.js.map +1 -0
  89. package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -1
  90. package/lib/module/hooks/useVisibleRanges.js +47 -19
  91. package/lib/module/hooks/useVisibleRanges.js.map +1 -1
  92. package/lib/module/hooks/useVisibleRanges.test.js +157 -0
  93. package/lib/module/hooks/useVisibleRanges.test.js.map +1 -0
  94. package/lib/module/index.js +1 -0
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/utils/{computeNewIndexWhenDataChanges.js → compute-offset-if-data-changed.js} +2 -2
  97. package/lib/module/utils/compute-offset-if-data-changed.js.map +1 -0
  98. package/lib/module/utils/compute-offset-if-data-changed.test.js +27 -0
  99. package/lib/module/utils/compute-offset-if-data-changed.test.js.map +1 -0
  100. package/lib/module/utils/compute-offset-if-size-changed.js +11 -0
  101. package/lib/module/utils/compute-offset-if-size-changed.js.map +1 -0
  102. package/lib/module/utils/compute-offset-if-size-changed.test.js +69 -0
  103. package/lib/module/utils/compute-offset-if-size-changed.test.js.map +1 -0
  104. package/lib/module/utils/handleroffset-direction.js +5 -5
  105. package/lib/module/utils/handleroffset-direction.js.map +1 -1
  106. package/lib/module/utils/handleroffset-direction.test.js +41 -0
  107. package/lib/module/utils/handleroffset-direction.test.js.map +1 -0
  108. package/lib/module/utils/index.test.js +6 -6
  109. package/lib/module/utils/index.test.js.map +1 -1
  110. package/lib/typescript/components/ItemRenderer.d.ts +22 -0
  111. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts +17 -0
  112. package/lib/typescript/components/Pagination/Basic/index.d.ts +16 -0
  113. package/lib/typescript/components/Pagination/index.d.ts +3 -0
  114. package/lib/typescript/components/ScrollViewGesture.d.ts +1 -1
  115. package/lib/typescript/components/rnr-demo.test.d.ts +1 -0
  116. package/lib/typescript/hooks/useCarouselController.d.ts +3 -2
  117. package/lib/typescript/hooks/useCommonVariables.test.d.ts +1 -0
  118. package/lib/typescript/hooks/useLayoutConfig.d.ts +1 -1
  119. package/lib/typescript/hooks/useOffsetX.test.d.ts +1 -0
  120. package/lib/typescript/hooks/usePanGestureProxy.d.ts +9 -0
  121. package/lib/typescript/hooks/usePanGestureProxy.test.d.ts +1 -0
  122. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +3 -2
  123. package/lib/typescript/hooks/useVisibleRanges.d.ts +8 -4
  124. package/lib/typescript/hooks/useVisibleRanges.test.d.ts +1 -0
  125. package/lib/typescript/index.d.ts +2 -0
  126. package/lib/typescript/types.d.ts +27 -16
  127. package/lib/typescript/utils/{computeNewIndexWhenDataChanges.d.ts → compute-offset-if-data-changed.d.ts} +1 -1
  128. package/lib/typescript/utils/compute-offset-if-data-changed.test.d.ts +1 -0
  129. package/lib/typescript/utils/compute-offset-if-size-changed.d.ts +5 -0
  130. package/lib/typescript/utils/compute-offset-if-size-changed.test.d.ts +1 -0
  131. package/lib/typescript/utils/handleroffset-direction.d.ts +2 -1
  132. package/lib/typescript/utils/handleroffset-direction.test.d.ts +1 -0
  133. package/package.json +18 -60
  134. package/src/{layouts → components}/BaseLayout.tsx +7 -35
  135. package/src/components/Carousel.tsx +33 -71
  136. package/src/components/ItemRenderer.tsx +105 -0
  137. package/src/components/Pagination/Basic/PaginationItem.tsx +111 -0
  138. package/src/components/Pagination/Basic/index.tsx +81 -0
  139. package/src/components/Pagination/index.tsx +5 -0
  140. package/src/components/ScrollViewGesture.tsx +74 -49
  141. package/src/components/rnr-demo.test.tsx +43 -0
  142. package/src/hooks/useCarouselController.tsx +24 -21
  143. package/src/hooks/useCommonVariables.test.tsx +41 -0
  144. package/src/hooks/useCommonVariables.ts +35 -10
  145. package/src/hooks/useLayoutConfig.ts +1 -1
  146. package/src/hooks/useOffsetX.test.ts +54 -0
  147. package/src/hooks/useOffsetX.ts +33 -31
  148. package/src/hooks/useOnProgressChange.ts +7 -2
  149. package/src/hooks/usePanGestureProxy.test.tsx +376 -0
  150. package/src/hooks/usePanGestureProxy.ts +110 -0
  151. package/src/hooks/useUpdateGestureConfig.ts +4 -2
  152. package/src/hooks/useVisibleRanges.test.tsx +179 -0
  153. package/src/hooks/useVisibleRanges.tsx +72 -24
  154. package/src/index.tsx +3 -0
  155. package/src/types.ts +28 -17
  156. package/src/utils/compute-offset-if-data-changed.test.ts +30 -0
  157. package/src/utils/{computeNewIndexWhenDataChanges.ts → compute-offset-if-data-changed.ts} +1 -1
  158. package/src/utils/compute-offset-if-size-changed.test.ts +78 -0
  159. package/src/utils/compute-offset-if-size-changed.ts +11 -0
  160. package/src/utils/handleroffset-direction.test.ts +52 -0
  161. package/src/utils/handleroffset-direction.ts +12 -9
  162. package/src/utils/index.test.ts +6 -6
  163. package/lib/commonjs/layouts/BaseLayout.js.map +0 -1
  164. package/lib/commonjs/layouts/ParallaxLayout.js +0 -84
  165. package/lib/commonjs/layouts/ParallaxLayout.js.map +0 -1
  166. package/lib/commonjs/utils/computeNewIndexWhenDataChanges.js.map +0 -1
  167. package/lib/module/layouts/BaseLayout.js.map +0 -1
  168. package/lib/module/layouts/ParallaxLayout.js +0 -61
  169. package/lib/module/layouts/ParallaxLayout.js.map +0 -1
  170. package/lib/module/utils/computeNewIndexWhenDataChanges.js.map +0 -1
  171. package/lib/typescript/layouts/ParallaxLayout.d.ts +0 -13
  172. package/src/layouts/ParallaxLayout.tsx +0 -141
  173. /package/lib/typescript/{layouts → components}/BaseLayout.d.ts +0 -0
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { StyleSheet } from "react-native";
3
3
  import { GestureHandlerRootView } from "react-native-gesture-handler";
4
4
  import { runOnJS, useDerivedValue } from "react-native-reanimated";
5
+ import { ItemRenderer } from "./ItemRenderer";
5
6
  import { ScrollViewGesture } from "./ScrollViewGesture";
6
7
  import { useAutoPlay } from "../hooks/useAutoPlay";
7
8
  import { useCarouselController } from "../hooks/useCarouselController";
@@ -10,8 +11,6 @@ import { useInitProps } from "../hooks/useInitProps";
10
11
  import { useLayoutConfig } from "../hooks/useLayoutConfig";
11
12
  import { useOnProgressChange } from "../hooks/useOnProgressChange";
12
13
  import { usePropsErrorBoundary } from "../hooks/usePropsErrorBoundary";
13
- import { useVisibleRanges } from "../hooks/useVisibleRanges";
14
- import { BaseLayout } from "../layouts/BaseLayout";
15
14
  import { CTX } from "../store";
16
15
  import { computedRealIndexWithAutoFillData } from "../utils/computed-with-auto-fill-data";
17
16
  const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
@@ -24,8 +23,6 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
24
23
  data,
25
24
  // Length of fill data
26
25
  dataLength,
27
- // Raw data that has not been processed
28
- rawData,
29
26
  // Length of raw data
30
27
  rawDataLength,
31
28
  mode,
@@ -39,10 +36,11 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
39
36
  autoPlayInterval,
40
37
  scrollAnimationDuration,
41
38
  withAnimation,
39
+ fixedDirection,
42
40
  renderItem,
43
41
  onScrollEnd,
44
42
  onSnapToItem,
45
- onScrollBegin,
43
+ onScrollStart,
46
44
  onProgressChange,
47
45
  customAnimation,
48
46
  defaultIndex
@@ -61,7 +59,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
61
59
  usePropsErrorBoundary({ ...props,
62
60
  dataLength
63
61
  });
64
- useOnProgressChange({
62
+ const progressValue = useOnProgressChange({
65
63
  autoFillData,
66
64
  loop,
67
65
  size,
@@ -77,9 +75,10 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
77
75
  handlerOffset,
78
76
  withAnimation,
79
77
  defaultIndex,
78
+ fixedDirection,
79
+ duration: scrollAnimationDuration,
80
80
  onScrollEnd: () => runOnJS(_onScrollEnd)(),
81
- onScrollBegin: () => !!onScrollBegin && runOnJS(onScrollBegin)(),
82
- duration: scrollAnimationDuration
81
+ onScrollStart: () => !!onScrollStart && runOnJS(onScrollStart)()
83
82
  });
84
83
  const {
85
84
  next,
@@ -111,10 +110,10 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
111
110
  if (onScrollEnd) onScrollEnd(realIndex);
112
111
  }, [loop, autoFillData, rawDataLength, getSharedIndex, onSnapToItem, onScrollEnd]);
113
112
 
114
- const scrollViewGestureOnScrollBegin = React.useCallback(() => {
113
+ const scrollViewGestureOnScrollStart = React.useCallback(() => {
115
114
  pauseAutoPlay();
116
- onScrollBegin === null || onScrollBegin === void 0 ? void 0 : onScrollBegin();
117
- }, [onScrollBegin, pauseAutoPlay]);
115
+ onScrollStart === null || onScrollStart === void 0 ? void 0 : onScrollStart();
116
+ }, [onScrollStart, pauseAutoPlay]);
118
117
  const scrollViewGestureOnScrollEnd = React.useCallback(() => {
119
118
  startAutoPlay();
120
119
 
@@ -126,41 +125,12 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
126
125
  next,
127
126
  prev,
128
127
  getCurrentIndex,
129
- scrollTo
128
+ scrollTo,
129
+ progressValue
130
130
  }), [getCurrentIndex, next, prev, scrollTo]);
131
- const visibleRanges = useVisibleRanges({
132
- total: dataLength,
133
- viewSize: size,
134
- translation: handlerOffset,
135
- windowSize
136
- });
137
131
  const layoutConfig = useLayoutConfig({ ...props,
138
132
  size
139
133
  });
140
- const renderLayout = React.useCallback((item, i) => {
141
- const realIndex = computedRealIndexWithAutoFillData({
142
- index: i,
143
- dataLength: rawDataLength,
144
- loop,
145
- autoFillData
146
- });
147
- return /*#__PURE__*/React.createElement(BaseLayout, {
148
- key: i,
149
- index: i,
150
- handlerOffset: offsetX,
151
- visibleRanges: visibleRanges,
152
- animationStyle: customAnimation || layoutConfig
153
- }, _ref => {
154
- let {
155
- animationValue
156
- } = _ref;
157
- return renderItem({
158
- item,
159
- index: realIndex,
160
- animationValue
161
- });
162
- });
163
- }, [loop, rawData, offsetX, visibleRanges, autoFillData, renderItem, layoutConfig, customAnimation]);
164
134
  return /*#__PURE__*/React.createElement(GestureHandlerRootView, null, /*#__PURE__*/React.createElement(CTX.Provider, {
165
135
  value: {
166
136
  props,
@@ -175,11 +145,24 @@ const Carousel = /*#__PURE__*/React.forwardRef((_props, ref) => {
175
145
  height: height || "100%"
176
146
  }, style, vertical ? styles.itemsVertical : styles.itemsHorizontal],
177
147
  testID: testID,
178
- onScrollBegin: scrollViewGestureOnScrollBegin,
148
+ onScrollStart: scrollViewGestureOnScrollStart,
179
149
  onScrollEnd: scrollViewGestureOnScrollEnd,
180
150
  onTouchBegin: scrollViewGestureOnTouchBegin,
181
151
  onTouchEnd: scrollViewGestureOnTouchEnd
182
- }, data.map(renderLayout))));
152
+ }, /*#__PURE__*/React.createElement(ItemRenderer, {
153
+ data: data,
154
+ dataLength: dataLength,
155
+ rawDataLength: rawDataLength,
156
+ loop: loop,
157
+ size: size,
158
+ windowSize: windowSize,
159
+ autoFillData: autoFillData,
160
+ offsetX: offsetX,
161
+ handlerOffset: handlerOffset,
162
+ layoutConfig: layoutConfig,
163
+ renderItem: renderItem,
164
+ customAnimation: customAnimation
165
+ }))));
183
166
  });
184
167
  export default Carousel;
185
168
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"sources":["Carousel.tsx"],"names":["React","StyleSheet","GestureHandlerRootView","runOnJS","useDerivedValue","ScrollViewGesture","useAutoPlay","useCarouselController","useCommonVariables","useInitProps","useLayoutConfig","useOnProgressChange","usePropsErrorBoundary","useVisibleRanges","BaseLayout","CTX","computedRealIndexWithAutoFillData","Carousel","forwardRef","_props","ref","props","testID","loop","autoFillData","data","dataLength","rawData","rawDataLength","mode","style","width","height","vertical","autoPlay","windowSize","autoPlayReverse","autoPlayInterval","scrollAnimationDuration","withAnimation","renderItem","onScrollEnd","onSnapToItem","onScrollBegin","onProgressChange","customAnimation","defaultIndex","commonVariables","size","handlerOffset","offsetX","totalSize","x","value","isNaN","carouselController","_onScrollEnd","duration","next","prev","scrollTo","getSharedIndex","getCurrentIndex","start","startAutoPlay","pause","pauseAutoPlay","useCallback","_sharedIndex","Math","round","realIndex","index","scrollViewGestureOnScrollBegin","scrollViewGestureOnScrollEnd","scrollViewGestureOnTouchBegin","scrollViewGestureOnTouchEnd","useImperativeHandle","visibleRanges","total","viewSize","translation","layoutConfig","renderLayout","item","i","animationValue","common","styles","container","itemsVertical","itemsHorizontal","map","create","overflow","flexDirection"],"mappings":"AAAA,OAAOA,KAAP,MAA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PgB,CAAlB,CAAf","sourcesContent":["import React from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport { GestureHandlerRootView } from \"react-native-gesture-handler\";\nimport { runOnJS, useDerivedValue } from \"react-native-reanimated\";\n\nimport { ScrollViewGesture } from \"./ScrollViewGesture\";\n\nimport { useAutoPlay } from \"../hooks/useAutoPlay\";\nimport { useCarouselController } from \"../hooks/useCarouselController\";\nimport { useCommonVariables } from \"../hooks/useCommonVariables\";\nimport { useInitProps } from \"../hooks/useInitProps\";\nimport { useLayoutConfig } from \"../hooks/useLayoutConfig\";\nimport { useOnProgressChange } from \"../hooks/useOnProgressChange\";\nimport { usePropsErrorBoundary } from \"../hooks/usePropsErrorBoundary\";\nimport { useVisibleRanges } from \"../hooks/useVisibleRanges\";\nimport { BaseLayout } from \"../layouts/BaseLayout\";\nimport { CTX } from \"../store\";\nimport type { ICarouselInstance, TCarouselProps } from \"../types\";\nimport { computedRealIndexWithAutoFillData } from \"../utils/computed-with-auto-fill-data\";\n\nconst Carousel = React.forwardRef<ICarouselInstance, TCarouselProps<any>>(\n (_props, ref) => {\n const props = useInitProps(_props);\n\n const {\n testID,\n loop,\n autoFillData,\n // Fill data with autoFillData\n data,\n // Length of fill data\n dataLength,\n // Raw data that has not been processed\n rawData,\n // Length of raw data\n rawDataLength,\n mode,\n style,\n width,\n height,\n vertical,\n autoPlay,\n windowSize,\n autoPlayReverse,\n autoPlayInterval,\n scrollAnimationDuration,\n withAnimation,\n renderItem,\n onScrollEnd,\n onSnapToItem,\n onScrollBegin,\n onProgressChange,\n customAnimation,\n defaultIndex,\n } = props;\n\n const commonVariables = useCommonVariables(props);\n const { size, handlerOffset } = commonVariables;\n\n const offsetX = useDerivedValue(() => {\n const totalSize = size * dataLength;\n const x = handlerOffset.value % totalSize;\n\n if (!loop)\n return handlerOffset.value;\n\n return isNaN(x) ? 0 : x;\n }, [loop, size, dataLength]);\n\n usePropsErrorBoundary({ ...props, dataLength });\n useOnProgressChange({\n autoFillData,\n loop,\n size,\n offsetX,\n rawDataLength,\n onProgressChange,\n });\n\n const carouselController = useCarouselController({\n loop,\n size,\n dataLength,\n autoFillData,\n handlerOffset,\n withAnimation,\n defaultIndex,\n onScrollEnd: () => runOnJS(_onScrollEnd)(),\n onScrollBegin: () => !!onScrollBegin && runOnJS(onScrollBegin)(),\n duration: scrollAnimationDuration,\n });\n\n const { next, prev, scrollTo, getSharedIndex, getCurrentIndex }\n = carouselController;\n\n const { start: startAutoPlay, pause: pauseAutoPlay } = useAutoPlay({\n autoPlay,\n autoPlayInterval,\n autoPlayReverse,\n carouselController,\n });\n\n const _onScrollEnd = React.useCallback(() => {\n const _sharedIndex = Math.round(getSharedIndex());\n\n const realIndex = computedRealIndexWithAutoFillData({\n index: _sharedIndex,\n dataLength: rawDataLength,\n loop,\n autoFillData,\n });\n\n if (onSnapToItem)\n onSnapToItem(realIndex);\n\n if (onScrollEnd)\n onScrollEnd(realIndex);\n }, [\n loop,\n autoFillData,\n rawDataLength,\n getSharedIndex,\n onSnapToItem,\n onScrollEnd,\n ]);\n\n const scrollViewGestureOnScrollBegin = React.useCallback(() => {\n pauseAutoPlay();\n onScrollBegin?.();\n }, [onScrollBegin, pauseAutoPlay]);\n\n const scrollViewGestureOnScrollEnd = React.useCallback(() => {\n startAutoPlay();\n _onScrollEnd();\n }, [_onScrollEnd, startAutoPlay]);\n\n const scrollViewGestureOnTouchBegin = React.useCallback(pauseAutoPlay, [\n pauseAutoPlay,\n ]);\n\n const scrollViewGestureOnTouchEnd = React.useCallback(startAutoPlay, [\n startAutoPlay,\n ]);\n\n React.useImperativeHandle(\n ref,\n () => ({\n next,\n prev,\n getCurrentIndex,\n scrollTo,\n }),\n [getCurrentIndex, next, prev, scrollTo],\n );\n\n const visibleRanges = useVisibleRanges({\n total: dataLength,\n viewSize: size,\n translation: handlerOffset,\n windowSize,\n });\n\n const layoutConfig = useLayoutConfig({ ...props, size });\n\n const renderLayout = React.useCallback(\n (item: any, i: number) => {\n const realIndex = computedRealIndexWithAutoFillData({\n index: i,\n dataLength: rawDataLength,\n loop,\n autoFillData,\n });\n\n return (\n <BaseLayout\n key={i}\n index={i}\n handlerOffset={offsetX}\n visibleRanges={visibleRanges}\n animationStyle={customAnimation || layoutConfig}\n >\n {({ animationValue }) =>\n renderItem({\n item,\n index: realIndex,\n animationValue,\n })\n }\n </BaseLayout>\n );\n },\n [\n loop,\n rawData,\n offsetX,\n visibleRanges,\n autoFillData,\n renderItem,\n layoutConfig,\n customAnimation,\n ],\n );\n\n return (\n <GestureHandlerRootView>\n <CTX.Provider value={{ props, common: commonVariables }}>\n <ScrollViewGesture\n key={mode}\n size={size}\n translation={handlerOffset}\n style={[\n styles.container,\n {\n width: width || \"100%\",\n height: height || \"100%\",\n },\n style,\n vertical\n ? styles.itemsVertical\n : styles.itemsHorizontal,\n ]}\n testID={testID}\n onScrollBegin={scrollViewGestureOnScrollBegin}\n onScrollEnd={scrollViewGestureOnScrollEnd}\n onTouchBegin={scrollViewGestureOnTouchBegin}\n onTouchEnd={scrollViewGestureOnTouchEnd}\n >\n {data.map(renderLayout)}\n </ScrollViewGesture>\n </CTX.Provider>\n </GestureHandlerRootView>\n );\n },\n);\n\nexport default Carousel as <T extends any>(\n props: React.PropsWithChildren<TCarouselProps<T>>\n) => React.ReactElement;\n\nconst styles = StyleSheet.create({\n container: {\n overflow: \"hidden\",\n },\n itemsHorizontal: {\n flexDirection: \"row\",\n },\n itemsVertical: {\n flexDirection: \"column\",\n },\n});\n"]}
1
+ {"version":3,"sources":["Carousel.tsx"],"names":["React","StyleSheet","GestureHandlerRootView","runOnJS","useDerivedValue","ItemRenderer","ScrollViewGesture","useAutoPlay","useCarouselController","useCommonVariables","useInitProps","useLayoutConfig","useOnProgressChange","usePropsErrorBoundary","CTX","computedRealIndexWithAutoFillData","Carousel","forwardRef","_props","ref","props","testID","loop","autoFillData","data","dataLength","rawDataLength","mode","style","width","height","vertical","autoPlay","windowSize","autoPlayReverse","autoPlayInterval","scrollAnimationDuration","withAnimation","fixedDirection","renderItem","onScrollEnd","onSnapToItem","onScrollStart","onProgressChange","customAnimation","defaultIndex","commonVariables","size","handlerOffset","offsetX","totalSize","x","value","isNaN","progressValue","carouselController","duration","_onScrollEnd","next","prev","scrollTo","getSharedIndex","getCurrentIndex","start","startAutoPlay","pause","pauseAutoPlay","useCallback","_sharedIndex","Math","round","realIndex","index","scrollViewGestureOnScrollStart","scrollViewGestureOnScrollEnd","scrollViewGestureOnTouchBegin","scrollViewGestureOnTouchEnd","useImperativeHandle","layoutConfig","common","styles","container","itemsVertical","itemsHorizontal","create","overflow","flexDirection"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,sBAAT,QAAuC,8BAAvC;AACA,SAASC,OAAT,EAAkBC,eAAlB,QAAyC,yBAAzC;AAEA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SAASC,iBAAT,QAAkC,qBAAlC;AAEA,SAASC,WAAT,QAA4B,sBAA5B;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AACA,SAASC,kBAAT,QAAmC,6BAAnC;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SAASC,eAAT,QAAgC,0BAAhC;AACA,SAASC,mBAAT,QAAoC,8BAApC;AACA,SAASC,qBAAT,QAAsC,gCAAtC;AACA,SAASC,GAAT,QAAoB,UAApB;AAEA,SAASC,iCAAT,QAAkD,uCAAlD;AAEA,MAAMC,QAAQ,gBAAGhB,KAAK,CAACiB,UAAN,CACf,CAACC,MAAD,EAASC,GAAT,KAAiB;AACf,QAAMC,KAAK,GAAGV,YAAY,CAACQ,MAAD,CAA1B;AAEA,QAAM;AACJG,IAAAA,MADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,YAHI;AAIJ;AACAC,IAAAA,IALI;AAMJ;AACAC,IAAAA,UAPI;AAQJ;AACAC,IAAAA,aATI;AAUJC,IAAAA,IAVI;AAWJC,IAAAA,KAXI;AAYJC,IAAA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AAA,KAAK,EAAEA,KAAK,IAAI,MADlB;AAEEC,MAAAA,MAAM,EAAEA,MAAM,IAAI;AAFpB,KAFK,EAMLF,KANK,EAOLG,QAAQ,GAAGiD,MAAM,CAACE,aAAV,GAA0BF,MAAM,CAACG,eAPpC,CAJT;AAaE,IAAA,MAAM,EAAE9D,MAbV;AAcE,IAAA,aAAa,EAAEoD,8BAdjB;AAeE,IAAA,WAAW,EAAEC,4BAff;AAgBE,IAAA,YAAY,EAAEC,6BAhBhB;AAiBE,IAAA,UAAU,EAAEC;AAjBd,kBAmBE,oBAAC,YAAD;AACE,IAAA,IAAI,EAAEpD,IADR;AAEE,IAAA,UAAU,EAAEC,UAFd;AAGE,IAAA,aAAa,EAAEC,aAHjB;AAIE,IAAA,IAAI,EAAEJ,IAJR;AAKE,IAAA,IAAI,EAAEyB,IALR;AAME,IAAA,UAAU,EAAEd,UANd;AAOE,IAAA,YAAY,EAAEV,YAPhB;AAQE,IAAA,OAAO,EAAE0B,OARX;AASE,IAAA,aAAa,EAAED,aATjB;AAUE,IAAA,YAAY,EAAE8B,YAVhB;AAWE,IAAA,UAAU,EAAEvC,UAXd;AAYE,IAAA,eAAe,EAAEK;AAZnB,IAnBF,CADF,CADF,CADF;AAwCD,CA/Kc,CAAjB;AAkLA,eAAe5B,QAAf;AAIA,MAAMgE,MAAM,GAAG/E,UAAU,CAACmF,MAAX,CAAkB;AAC/BH,EAAAA,SAAS,EAAE;AACTI,IAAAA,QAAQ,EAAE;AADD,GADoB;AAI/BF,EAAAA,eAAe,EAAE;AACfG,IAAAA,aAAa,EAAE;AADA,GAJc;AAO/BJ,EAAAA,aAAa,EAAE;AACbI,IAAAA,aAAa,EAAE;AADF;AAPgB,CAAlB,CAAf","sourcesContent":["import React from \"react\";\nimport { StyleSheet } from \"react-native\";\nimport { GestureHandlerRootView } from \"react-native-gesture-handler\";\nimport { runOnJS, useDerivedValue } from \"react-native-reanimated\";\n\nimport { ItemRenderer } from \"./ItemRenderer\";\nimport { ScrollViewGesture } from \"./ScrollViewGesture\";\n\nimport { useAutoPlay } from \"../hooks/useAutoPlay\";\nimport { useCarouselController } from \"../hooks/useCarouselController\";\nimport { useCommonVariables } from \"../hooks/useCommonVariables\";\nimport { useInitProps } from \"../hooks/useInitProps\";\nimport { useLayoutConfig } from \"../hooks/useLayoutConfig\";\nimport { useOnProgressChange } from \"../hooks/useOnProgressChange\";\nimport { usePropsErrorBoundary } from \"../hooks/usePropsErrorBoundary\";\nimport { CTX } from \"../store\";\nimport type { ICarouselInstance, TCarouselProps } from \"../types\";\nimport { computedRealIndexWithAutoFillData } from \"../utils/computed-with-auto-fill-data\";\n\nconst Carousel = React.forwardRef<ICarouselInstance, TCarouselProps<any>>(\n (_props, ref) => {\n const props = useInitProps(_props);\n\n const {\n testID,\n loop,\n autoFillData,\n // Fill data with autoFillData\n data,\n // Length of fill data\n dataLength,\n // Length of raw data\n rawDataLength,\n mode,\n style,\n width,\n height,\n vertical,\n autoPlay,\n windowSize,\n autoPlayReverse,\n autoPlayInterval,\n scrollAnimationDuration,\n withAnimation,\n fixedDirection,\n renderItem,\n onScrollEnd,\n onSnapToItem,\n onScrollStart,\n onProgressChange,\n customAnimation,\n defaultIndex,\n } = props;\n\n const commonVariables = useCommonVariables(props);\n const { size, handlerOffset } = commonVariables;\n\n const offsetX = useDerivedValue(() => {\n const totalSize = size * dataLength;\n const x = handlerOffset.value % totalSize;\n\n if (!loop) return handlerOffset.value;\n\n return isNaN(x) ? 0 : x;\n }, [loop, size, dataLength]);\n\n usePropsErrorBoundary({ ...props, dataLength });\n const progressValue = useOnProgressChange({\n autoFillData,\n loop,\n size,\n offsetX,\n rawDataLength,\n onProgressChange,\n });\n\n const carouselController = useCarouselController({\n loop,\n size,\n dataLength,\n autoFillData,\n handlerOffset,\n withAnimation,\n defaultIndex,\n fixedDirection,\n duration: scrollAnimationDuration,\n onScrollEnd: () => runOnJS(_onScrollEnd)(),\n onScrollStart: () => !!onScrollStart && runOnJS(onScrollStart)(),\n });\n\n const { next, prev, scrollTo, getSharedIndex, getCurrentIndex } =\n carouselController;\n\n const { start: startAutoPlay, pause: pauseAutoPlay } = useAutoPlay({\n autoPlay,\n autoPlayInterval,\n autoPlayReverse,\n carouselController,\n });\n\n const _onScrollEnd = React.useCallback(() => {\n const _sharedIndex = Math.round(getSharedIndex());\n\n const realIndex = computedRealIndexWithAutoFillData({\n index: _sharedIndex,\n dataLength: rawDataLength,\n loop,\n autoFillData,\n });\n\n if (onSnapToItem) onSnapToItem(realIndex);\n\n if (onScrollEnd) onScrollEnd(realIndex);\n }, [\n loop,\n autoFillData,\n rawDataLength,\n getSharedIndex,\n onSnapToItem,\n onScrollEnd,\n ]);\n\n const scrollViewGestureOnScrollStart = React.useCallback(() => {\n pauseAutoPlay();\n onScrollStart?.();\n }, [onScrollStart, pauseAutoPlay]);\n\n const scrollViewGestureOnScrollEnd = React.useCallback(() => {\n startAutoPlay();\n _onScrollEnd();\n }, [_onScrollEnd, startAutoPlay]);\n\n const scrollViewGestureOnTouchBegin = React.useCallback(pauseAutoPlay, [\n pauseAutoPlay,\n ]);\n\n const scrollViewGestureOnTouchEnd = React.useCallback(startAutoPlay, [\n startAutoPlay,\n ]);\n\n React.useImperativeHandle(\n ref,\n () => ({\n next,\n prev,\n getCurrentIndex,\n scrollTo,\n progressValue,\n }),\n [getCurrentIndex, next, prev, scrollTo],\n );\n\n const layoutConfig = useLayoutConfig({ ...props, size });\n\n return (\n <GestureHandlerRootView>\n <CTX.Provider value={{ props, common: commonVariables }}>\n <ScrollViewGesture\n key={mode}\n size={size}\n translation={handlerOffset}\n style={[\n styles.container,\n {\n width: width || \"100%\",\n height: height || \"100%\",\n },\n style,\n vertical ? styles.itemsVertical : styles.itemsHorizontal,\n ]}\n testID={testID}\n onScrollStart={scrollViewGestureOnScrollStart}\n onScrollEnd={scrollViewGestureOnScrollEnd}\n onTouchBegin={scrollViewGestureOnTouchBegin}\n onTouchEnd={scrollViewGestureOnTouchEnd}\n >\n <ItemRenderer\n data={data}\n dataLength={dataLength}\n rawDataLength={rawDataLength}\n loop={loop}\n size={size}\n windowSize={windowSize}\n autoFillData={autoFillData}\n offsetX={offsetX}\n handlerOffset={handlerOffset}\n layoutConfig={layoutConfig}\n renderItem={renderItem}\n customAnimation={customAnimation}\n />\n </ScrollViewGesture>\n </CTX.Provider>\n </GestureHandlerRootView>\n );\n },\n);\n\nexport default Carousel as <T extends any>(\n props: React.PropsWithChildren<TCarouselProps<T>>,\n) => React.ReactElement;\n\nconst styles = StyleSheet.create({\n container: {\n overflow: \"hidden\",\n },\n itemsHorizontal: {\n flexDirection: \"row\",\n },\n itemsVertical: {\n flexDirection: \"column\",\n },\n});\n"]}
@@ -0,0 +1,62 @@
1
+ import React from "react";
2
+ import { useAnimatedReaction, runOnJS } from "react-native-reanimated";
3
+ import { BaseLayout } from "./BaseLayout";
4
+ import { useVisibleRanges } from "../hooks/useVisibleRanges";
5
+ import { computedRealIndexWithAutoFillData } from "../utils/computed-with-auto-fill-data";
6
+ export const ItemRenderer = props => {
7
+ const {
8
+ data,
9
+ size,
10
+ windowSize,
11
+ handlerOffset,
12
+ offsetX,
13
+ dataLength,
14
+ rawDataLength,
15
+ loop,
16
+ autoFillData,
17
+ layoutConfig,
18
+ renderItem,
19
+ customAnimation
20
+ } = props;
21
+ const visibleRanges = useVisibleRanges({
22
+ total: dataLength,
23
+ viewSize: size,
24
+ translation: handlerOffset,
25
+ windowSize,
26
+ loop
27
+ });
28
+ const [displayedItems, setDisplayedItems] = React.useState(null);
29
+ useAnimatedReaction(() => visibleRanges.value, ranges => runOnJS(setDisplayedItems)(ranges), [visibleRanges]);
30
+ if (!displayedItems) return null;
31
+ return /*#__PURE__*/React.createElement(React.Fragment, null, data.map((item, index) => {
32
+ const realIndex = computedRealIndexWithAutoFillData({
33
+ index,
34
+ dataLength: rawDataLength,
35
+ loop,
36
+ autoFillData
37
+ });
38
+ const {
39
+ negativeRange,
40
+ positiveRange
41
+ } = displayedItems;
42
+ const shouldRender = index >= negativeRange[0] && index <= negativeRange[1] || index >= positiveRange[0] && index <= positiveRange[1];
43
+ if (!shouldRender) return null;
44
+ return /*#__PURE__*/React.createElement(BaseLayout, {
45
+ key: index,
46
+ index: index,
47
+ handlerOffset: offsetX,
48
+ visibleRanges: visibleRanges,
49
+ animationStyle: customAnimation || layoutConfig
50
+ }, _ref => {
51
+ let {
52
+ animationValue
53
+ } = _ref;
54
+ return renderItem({
55
+ item,
56
+ index: realIndex,
57
+ animationValue
58
+ });
59
+ });
60
+ }));
61
+ };
62
+ //# sourceMappingURL=ItemRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["ItemRenderer.tsx"],"names":["React","useAnimatedReaction","runOnJS","BaseLayout","useVisibleRanges","computedRealIndexWithAutoFillData","ItemRenderer","props","data","size","windowSize","handlerOffset","offsetX","dataLength","rawDataLength","loop","autoFillData","layoutConfig","renderItem","customAnimation","visibleRanges","total","viewSize","translation","displayedItems","setDisplayedItems","useState","value","ranges","map","item","index","realIndex","negativeRange","positiveRange","shouldRender","animationValue"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAIA,SAASC,mBAAT,EAAsDC,OAAtD,QAAqE,yBAArE;AAGA,SAASC,UAAT,QAA2B,cAA3B;AAGA,SAASC,gBAAT,QAAiC,2BAAjC;AAEA,SAASC,iCAAT,QAAkD,uCAAlD;AAiBA,OAAO,MAAMC,YAAuB,GAAIC,KAAD,IAAW;AAChD,QAAM;AACJC,IAAAA,IADI;AAEJC,IAAAA,IAFI;AAGJC,IAAAA,UAHI;AAIJC,IAAAA,aAJI;AAKJC,IAAAA,OALI;AAMJC,IAAAA,UANI;AAOJC,IAAAA,aAPI;AAQJC,IAAAA,IARI;AASJC,IAAAA,YATI;AAUJC,IAAAA,YAVI;AAWJC,IAAAA,UAXI;AAYJC,IAAAA;AAZI,MAaFZ,KAbJ;AAeA,QAAMa,aAAa,GAAGhB,gBAAgB,CAAC;AACrCiB,IAAAA,KAAK,EAAER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AAA,aACClB,UAAU,CAAC;AACTY,QAAAA,IADS;AAETC,QAAAA,KAAK,EAAEC,SAFE;AAGTI,QAAAA;AAHS,OAAD,CADX;AAAA,KAPH,CADF;AAiBD,GAjCD,CAFJ,CADF;AAwCD,CA3EM","sourcesContent":["import React from \"react\";\nimport type { FC } from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport type Animated from \"react-native-reanimated\";\nimport { useAnimatedReaction, type AnimatedStyleProp, runOnJS } from \"react-native-reanimated\";\n\nimport type { TAnimationStyle } from \"./BaseLayout\";\nimport { BaseLayout } from \"./BaseLayout\";\n\nimport type { VisibleRanges } from \"../hooks/useVisibleRanges\";\nimport { useVisibleRanges } from \"../hooks/useVisibleRanges\";\nimport type { CarouselRenderItem } from \"../types\";\nimport { computedRealIndexWithAutoFillData } from \"../utils/computed-with-auto-fill-data\";\n\ninterface Props {\n data: any[]\n dataLength: number\n rawDataLength: number\n loop: boolean\n size: number\n windowSize?: number\n autoFillData: boolean\n offsetX: Animated.SharedValue<number>\n handlerOffset: Animated.SharedValue<number>\n layoutConfig: TAnimationStyle\n renderItem: CarouselRenderItem<any>\n customAnimation?: ((value: number) => AnimatedStyleProp<ViewStyle>)\n}\n\nexport const ItemRenderer: FC<Props> = (props) => {\n const {\n data,\n size,\n windowSize,\n handlerOffset,\n offsetX,\n dataLength,\n rawDataLength,\n loop,\n autoFillData,\n layoutConfig,\n renderItem,\n customAnimation,\n } = props;\n\n const visibleRanges = useVisibleRanges({\n total: dataLength,\n viewSize: size,\n translation: handlerOffset,\n windowSize,\n loop,\n });\n\n const [displayedItems, setDisplayedItems] = React.useState<VisibleRanges>(null!);\n\n useAnimatedReaction(\n () => visibleRanges.value,\n ranges => runOnJS(setDisplayedItems)(ranges),\n [visibleRanges],\n );\n\n if (!displayedItems)\n return null;\n\n return (\n <>\n {\n data.map((item, index) => {\n const realIndex = computedRealIndexWithAutoFillData({\n index,\n dataLength: rawDataLength,\n loop,\n autoFillData,\n });\n\n const { negativeRange, positiveRange } = displayedItems;\n\n const shouldRender = (index >= negativeRange[0] && index <= negativeRange[1])\n || (index >= positiveRange[0] && index <= positiveRange[1]);\n\n if (!shouldRender)\n return null;\n\n return (\n <BaseLayout\n key={index}\n index={index}\n handlerOffset={offsetX}\n visibleRanges={visibleRanges}\n animationStyle={customAnimation || layoutConfig}\n >\n {({ animationValue }) =>\n renderItem({\n item,\n index: realIndex,\n animationValue,\n })\n }\n </BaseLayout>\n );\n })\n }\n </>\n );\n};\n"]}
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import Animated, { Extrapolate, interpolate, useAnimatedStyle } from "react-native-reanimated";
4
+ export const PaginationItem = props => {
5
+ const {
6
+ animValue,
7
+ dotStyle,
8
+ activeDotStyle,
9
+ index,
10
+ count,
11
+ size,
12
+ horizontal,
13
+ children
14
+ } = props;
15
+ const defaultDotSize = 10;
16
+ const sizes = {
17
+ width: size || (dotStyle === null || dotStyle === void 0 ? void 0 : dotStyle.width) || defaultDotSize,
18
+ height: size || (dotStyle === null || dotStyle === void 0 ? void 0 : dotStyle.height) || defaultDotSize
19
+ };
20
+ /**
21
+ * TODO: Keep this for future implementation
22
+ * Used to change the size of the active dot with animation
23
+ */
24
+ // const animatedSize = {
25
+ // width: activeDotStyle?.width,
26
+ // height: activeDotStyle?.height,
27
+ // };
28
+
29
+ const width = sizes.width;
30
+ const height = sizes.height;
31
+ const animStyle = useAnimatedStyle(() => {
32
+ const size = horizontal ? height : width;
33
+ let inputRange = [index - 1, index, index + 1];
34
+ let outputRange = [-size, 0, size];
35
+
36
+ if (index === 0 && (animValue === null || animValue === void 0 ? void 0 : animValue.value) > count - 1) {
37
+ inputRange = [count - 1, count, count + 1];
38
+ outputRange = [-size, 0, size];
39
+ }
40
+
41
+ return {
42
+ transform: [{
43
+ translateX: interpolate(animValue === null || animValue === void 0 ? void 0 : animValue.value, inputRange, outputRange, Extrapolate.CLAMP)
44
+ }]
45
+ };
46
+ }, [animValue, index, count, horizontal]);
47
+ return /*#__PURE__*/React.createElement(View, {
48
+ style: [{
49
+ width,
50
+ height,
51
+ overflow: "hidden",
52
+ transform: [{
53
+ rotateZ: horizontal ? "90deg" : "0deg"
54
+ }]
55
+ }, dotStyle]
56
+ }, /*#__PURE__*/React.createElement(Animated.View, {
57
+ style: [{
58
+ backgroundColor: "black",
59
+ flex: 1
60
+ }, animStyle, activeDotStyle]
61
+ }, children));
62
+ };
63
+ //# sourceMappingURL=PaginationItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["PaginationItem.tsx"],"names":["React","View","Animated","Extrapolate","interpolate","useAnimatedStyle","PaginationItem","props","animValue","dotStyle","activeDotStyle","index","count","size","horizontal","children","defaultDotSize","sizes","width","height","animStyle","inputRange","outputRange","value","transform","translateX","CLAMP","overflow","rotateZ","backgroundColor","flex"],"mappings":"AACA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,IAAT,QAAqB,cAArB;AACA,OAAOC,QAAP,IACEC,WADF,EAEEC,WAFF,EAGEC,gBAHF,QAIO,yBAJP;AAWA,OAAO,MAAMC,cAUZ,GAAIC,KAAD,IAAW;AACb,QAAM;AACJC,IAAAA,SADI;AAEJC,IAAAA,QAFI;AAGJC,IAAAA,cAHI;AAIJC,IAAAA,KAJI;AAKJC,IAAAA,KALI;AAMJC,IAAAA,IANI;AAOJC,IAAAA,UAPI;AAQJC,IAAAA;AARI,MASFR,KATJ;AAWA,QAAMS,cAAc,GAAG,EAAvB;AAEA,QAAMC,KAAK,GAAG;AACZC,IAAAA,KAAK,EAAEL,IAAI,KAAIJ,QAAJ,aAAIA,QAAJ,uBAAIA,QAAQ,CAAES,KAAd,CAAJ,IAA2BF,cADtB;AAEZG,IAAAA,MAAM,EAAEN,IAAI,KAAIJ,QAAJ,aAAIA,QAAJ,uBAAIA,QAAQ,CAAEU,MAAd,CAAJ,IAA4BH;AAFxB,GAAd;AAKA;AACF;AACA;AACA;AACE;AACA;AACA;AACA;;AAEA,QAA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,kBAeE,oBAAC,QAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAE,CACL;AACEoB,MAAAA,eAAe,EAAE,OADnB;AAEEC,MAAAA,IAAI,EAAE;AAFR,KADK,EAKLV,SALK,EAMLV,cANK;AADT,KAUGK,QAVH,CAfF,CADF;AA8BD,CA/FM","sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport { View } from \"react-native\";\nimport Animated, {\n Extrapolate,\n interpolate,\n useAnimatedStyle,\n} from \"react-native-reanimated\";\n\nexport type DotStyle = Omit<ViewStyle, \"width\" | \"height\"> & {\n width?: number\n height?: number\n};\n\nexport const PaginationItem: React.FC<\nPropsWithChildren<{\n index: number\n count: number\n size?: number\n animValue: Animated.SharedValue<number>\n horizontal?: boolean\n dotStyle?: DotStyle\n activeDotStyle?: DotStyle\n}>\n> = (props) => {\n const {\n animValue,\n dotStyle,\n activeDotStyle,\n index,\n count,\n size,\n horizontal,\n children,\n } = props;\n\n const defaultDotSize = 10;\n\n const sizes = {\n width: size || dotStyle?.width || defaultDotSize,\n height: size || dotStyle?.height || defaultDotSize,\n };\n\n /**\n * TODO: Keep this for future implementation\n * Used to change the size of the active dot with animation\n */\n // const animatedSize = {\n // width: activeDotStyle?.width,\n // height: activeDotStyle?.height,\n // };\n\n const width = sizes.width;\n const height = sizes.height;\n\n const animStyle = useAnimatedStyle(() => {\n const size = horizontal ? height : width;\n let inputRange = [index - 1, index, index + 1];\n let outputRange = [-size, 0, size];\n\n if (index === 0 && animValue?.value > count - 1) {\n inputRange = [count - 1, count, count + 1];\n outputRange = [-size, 0, size];\n }\n\n return {\n transform: [\n {\n translateX: interpolate(\n animValue?.value,\n inputRange,\n outputRange,\n Extrapolate.CLAMP,\n ),\n },\n ],\n };\n }, [animValue, index, count, horizontal]);\n\n return (\n <View\n style={[\n {\n width,\n height,\n overflow: \"hidden\",\n transform: [\n {\n rotateZ: horizontal ? \"90deg\" : \"0deg\",\n },\n ],\n },\n dotStyle,\n ]}\n >\n <Animated.View\n style={[\n {\n backgroundColor: \"black\",\n flex: 1,\n },\n animStyle,\n activeDotStyle,\n ]}\n >\n {children}\n </Animated.View>\n </View>\n );\n};\n"]}
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import { TouchableWithoutFeedback } from "react-native-gesture-handler";
4
+ import { PaginationItem } from "./PaginationItem";
5
+ export const Basic = props => {
6
+ const {
7
+ activeDotStyle,
8
+ dotStyle,
9
+ progress,
10
+ horizontal = true,
11
+ data,
12
+ size,
13
+ containerStyle,
14
+ renderItem,
15
+ onPress
16
+ } = props;
17
+ if (typeof size === "string" || typeof (dotStyle === null || dotStyle === void 0 ? void 0 : dotStyle.width) === "string" || typeof (dotStyle === null || dotStyle === void 0 ? void 0 : dotStyle.height) === "string") throw new Error("size/width/height must be a number");
18
+ return /*#__PURE__*/React.createElement(View, {
19
+ style: [{
20
+ justifyContent: "space-between",
21
+ alignSelf: "center"
22
+ }, horizontal ? {
23
+ flexDirection: "row"
24
+ } : {
25
+ flexDirection: "column"
26
+ }, containerStyle]
27
+ }, data.map((item, index) => {
28
+ return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
29
+ key: index,
30
+ onPress: () => onPress === null || onPress === void 0 ? void 0 : onPress(index)
31
+ }, /*#__PURE__*/React.createElement(PaginationItem, {
32
+ index: index,
33
+ size: size,
34
+ count: data.length,
35
+ dotStyle: dotStyle,
36
+ animValue: progress,
37
+ horizontal: !horizontal,
38
+ activeDotStyle: activeDotStyle
39
+ }, renderItem === null || renderItem === void 0 ? void 0 : renderItem(item, index)));
40
+ }));
41
+ };
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["React","View","TouchableWithoutFeedback","PaginationItem","Basic","props","activeDotStyle","dotStyle","progress","horizontal","data","size","containerStyle","renderItem","onPress","width","height","Error","justifyContent","alignSelf","flexDirection","map","item","index","length"],"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JZ;AAKE,MAAA,SAAS,EAAEC,QALb;AAME,MAAA,UAAU,EAAE,CAACC,UANf;AAOE,MAAA,cAAc,EAAEH;AAPlB,OASGO,UATH,aASGA,UATH,uBASGA,UAAU,CAAGS,IAAH,EAASC,KAAT,CATb,CAJF,CADF;AAkBD,GAnBA,CAhBH,CADF;AAuCD,CA3DM","sourcesContent":["import React from \"react\";\nimport type { StyleProp, ViewStyle } from \"react-native\";\nimport { View } from \"react-native\";\nimport { TouchableWithoutFeedback } from \"react-native-gesture-handler\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nimport type { DotStyle } from \"./PaginationItem\";\nimport { PaginationItem } from \"./PaginationItem\";\n\nexport interface BasicProps<T extends {} = {}> {\n progress: SharedValue<number>\n horizontal?: boolean\n data: Array<T>\n renderItem?: (item: T, index: number) => React.ReactNode\n containerStyle?: StyleProp<ViewStyle>\n dotStyle?: DotStyle\n activeDotStyle?: DotStyle\n size?: number\n onPress?: (index: number) => void\n}\n\nexport const Basic = <T extends {}>(props: BasicProps<T>) => {\n const {\n activeDotStyle,\n dotStyle,\n progress,\n horizontal = true,\n data,\n size,\n containerStyle,\n renderItem,\n onPress,\n } = props;\n\n if (\n typeof size === \"string\" ||\n typeof dotStyle?.width === \"string\" ||\n typeof dotStyle?.height === \"string\"\n )\n throw new Error(\"size/width/height must be a number\");\n\n return (\n <View\n style={[\n {\n justifyContent: \"space-between\",\n alignSelf: \"center\",\n },\n horizontal\n ? {\n flexDirection: \"row\",\n }\n : {\n flexDirection: \"column\",\n },\n containerStyle,\n ]}\n >\n {data.map((item, index) => {\n return (\n <TouchableWithoutFeedback\n key={index}\n onPress={() => onPress?.(index)}\n >\n <PaginationItem\n index={index}\n size={size}\n count={data.length}\n dotStyle={dotStyle}\n animValue={progress}\n horizontal={!horizontal}\n activeDotStyle={activeDotStyle}\n >\n {renderItem?.(item, index)}\n </PaginationItem>\n </TouchableWithoutFeedback>\n );\n })}\n </View>\n );\n};\n"]}
@@ -0,0 +1,5 @@
1
+ import { Basic } from "./Basic";
2
+ export const Pagination = {
3
+ Basic
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.tsx"],"names":["Basic","Pagination"],"mappings":"AAAA,SAASA,KAAT,QAAsB,SAAtB;AAEA,OAAO,MAAMC,UAAU,GAAG;AACxBD,EAAAA;AADwB,CAAnB","sourcesContent":["import { Basic } from \"./Basic\";\n\nexport const Pagination = {\n Basic,\n};\n"]}
@@ -1,8 +1,8 @@
1
- import React, { useCallback, useMemo } from "react";
2
- import { Gesture, GestureDetector } from "react-native-gesture-handler";
1
+ import React, { useCallback } from "react";
2
+ import { GestureDetector } from "react-native-gesture-handler";
3
3
  import Animated, { cancelAnimation, measure, runOnJS, useAnimatedReaction, useAnimatedRef, useDerivedValue, useSharedValue, withDecay } from "react-native-reanimated";
4
4
  import { Easing } from "../constants";
5
- import { useUpdateGestureConfig } from "../hooks/useUpdateGestureConfig";
5
+ import { usePanGestureProxy } from "../hooks/usePanGestureProxy";
6
6
  import { CTX } from "../store";
7
7
  import { dealWithAnimation } from "../utils/deal-with-animation";
8
8
 
@@ -13,13 +13,15 @@ const IScrollViewGesture = props => {
13
13
  vertical,
14
14
  pagingEnabled,
15
15
  snapEnabled,
16
- loop: infinite,
16
+ loop,
17
17
  scrollAnimationDuration,
18
18
  withAnimation,
19
19
  enabled,
20
20
  dataLength,
21
21
  overscrollEnabled,
22
- maxScrollDistancePerSwipe
22
+ maxScrollDistancePerSwipe,
23
+ minScrollDistancePerSwipe,
24
+ fixedDirection
23
25
  }
24
26
  } = React.useContext(CTX);
25
27
  const {
@@ -27,7 +29,7 @@ const IScrollViewGesture = props => {
27
29
  translation,
28
30
  testID,
29
31
  style = {},
30
- onScrollBegin,
32
+ onScrollStart,
31
33
  onScrollEnd,
32
34
  onTouchBegin,
33
35
  onTouchEnd
@@ -41,12 +43,13 @@ const IScrollViewGesture = props => {
41
43
  const scrollEndTranslation = useSharedValue(0);
42
44
  const scrollEndVelocity = useSharedValue(0);
43
45
  const containerRef = useAnimatedRef();
44
- const maxScrollDistancePerSwipeIsSet = typeof maxScrollDistancePerSwipe === "number"; // Get the limit of the scroll.
46
+ const maxScrollDistancePerSwipeIsSet = typeof maxScrollDistancePerSwipe === "number";
47
+ const minScrollDistancePerSwipeIsSet = typeof minScrollDistancePerSwipe === "number"; // Get the limit of the scroll.
45
48
 
46
49
  const getLimit = React.useCallback(() => {
47
50
  "worklet";
48
51
 
49
- if (!infinite && !overscrollEnabled) {
52
+ if (!loop && !overscrollEnabled) {
50
53
  const {
51
54
  width: containerWidth = 0
52
55
  } = measure(containerRef); // If the item's total width is less than the container's width, then there is no need to scroll.
@@ -57,7 +60,7 @@ const IScrollViewGesture = props => {
57
60
  }
58
61
 
59
62
  return dataLength * size;
60
- }, [infinite, size, dataLength, overscrollEnabled]);
63
+ }, [loop, size, dataLength, overscrollEnabled]);
61
64
  const withSpring = React.useCallback((toValue, onFinished) => {
62
65
  "worklet";
63
66
 
@@ -102,7 +105,7 @@ const IScrollViewGesture = props => {
102
105
  const computed = offset < 0 ? Math.ceil : Math.floor;
103
106
  const page = computed(-translation.value / size);
104
107
 
105
- if (infinite) {
108
+ if (loop) {
106
109
  const finalPage = page + offset;
107
110
  finalTranslation = withSpring(withProcessTranslation(-finalPage * size), onFinished);
108
111
  } else {
@@ -121,7 +124,7 @@ const IScrollViewGesture = props => {
121
124
  translation.value = finalTranslation;
122
125
 
123
126
  function withProcessTranslation(translation) {
124
- if (!infinite && !overscrollEnabled) {
127
+ if (!loop && !overscrollEnabled) {
125
128
  const limit = getLimit();
126
129
  const sign = Math.sign(translation);
127
130
  return sign * Math.max(0, Math.min(limit, Math.abs(translation)));
@@ -129,7 +132,7 @@ const IScrollViewGesture = props => {
129
132
 
130
133
  return translation;
131
134
  }
132
- }, [withSpring, size, maxPage, infinite, snapEnabled, translation, pagingEnabled, scrollEndVelocity.value, maxScrollDistancePerSwipe, scrollEndTranslation.value, maxScrollDistancePerSwipeIsSet]);
135
+ }, [withSpring, size, maxPage, loop, snapEnabled, translation, pagingEnabled, scrollEndVelocity.value, maxScrollDistancePerSwipe, scrollEndTranslation.value, maxScrollDistancePerSwipeIsSet]);
133
136
  const onFinish = React.useCallback(isFinished => {
134
137
  "worklet";
135
138
 
@@ -157,7 +160,7 @@ const IScrollViewGesture = props => {
157
160
  return;
158
161
  }
159
162
 
160
- if (!infinite) {
163
+ if (!loop) {
161
164
  translation.value = withSpring(0);
162
165
  return;
163
166
  }
@@ -169,9 +172,9 @@ const IScrollViewGesture = props => {
169
172
  return;
170
173
  }
171
174
 
172
- if (!infinite) translation.value = withSpring(-((maxPage - 1) * size));
175
+ if (!loop) translation.value = withSpring(-((maxPage - 1) * size));
173
176
  }
174
- }, [touching.value, translation, maxPage, size, scrollEndTranslation.value, infinite, activeDecay, withSpring]);
177
+ }, [touching.value, translation, maxPage, size, scrollEndTranslation.value, loop, activeDecay, withSpring]);
175
178
  useAnimatedReaction(() => translation.value, () => {
176
179
  if (!pagingEnabled) resetBoundary();
177
180
  }, [pagingEnabled, resetBoundary]);
@@ -179,7 +182,7 @@ const IScrollViewGesture = props => {
179
182
  function withProcessTranslation(translation) {
180
183
  "worklet";
181
184
 
182
- if (!infinite && !overscrollEnabled) {
185
+ if (!loop && !overscrollEnabled) {
183
186
  const limit = getLimit();
184
187
  const sign = Math.sign(translation);
185
188
  return sign * Math.max(0, Math.min(limit, Math.abs(translation)));
@@ -188,16 +191,16 @@ const IScrollViewGesture = props => {
188
191
  return translation;
189
192
  }
190
193
 
191
- const onGestureBegin = useCallback(() => {
194
+ const onGestureStart = useCallback(_ => {
192
195
  "worklet";
193
196
 
194
197
  touching.value = true;
195
198
  validStart.value = true;
196
- onScrollBegin && runOnJS(onScrollBegin)();
199
+ onScrollStart && runOnJS(onScrollStart)();
197
200
  max.value = (maxPage - 1) * size;
198
- if (!infinite && !overscrollEnabled) max.value = getLimit();
201
+ if (!loop && !overscrollEnabled) max.value = getLimit();
199
202
  panOffset.value = translation.value;
200
- }, [max, size, maxPage, infinite, touching, panOffset, validStart, translation, overscrollEnabled, getLimit, onScrollBegin]);
203
+ }, [max, size, maxPage, loop, touching, panOffset, validStart, translation, overscrollEnabled, getLimit, onScrollStart]);
201
204
  const onGestureUpdate = useCallback(e => {
202
205
  "worklet";
203
206
 
@@ -211,9 +214,10 @@ const IScrollViewGesture = props => {
211
214
  translationX,
212
215
  translationY
213
216
  } = e;
214
- const panTranslation = isHorizontal.value ? translationX : translationY;
217
+ let panTranslation = isHorizontal.value ? translationX : translationY;
218
+ if (fixedDirection === "negative") panTranslation = -Math.abs(panTranslation);else if (fixedDirection === "positive") panTranslation = +Math.abs(panTranslation);
215
219
 
216
- if (!infinite) {
220
+ if (!loop) {
217
221
  if (translation.value > 0 || translation.value < -max.value) {
218
222
  const boundary = translation.value > 0 ? 0 : -max.value;
219
223
  const fixed = boundary - panOffset.value;
@@ -225,8 +229,8 @@ const IScrollViewGesture = props => {
225
229
 
226
230
  const translationValue = panOffset.value + panTranslation;
227
231
  translation.value = translationValue;
228
- }, [isHorizontal, max, panOffset, infinite, overscrollEnabled, translation, validStart, touching]);
229
- const onGestureFinish = useCallback(e => {
232
+ }, [isHorizontal, max, panOffset, loop, overscrollEnabled, fixedDirection, translation, validStart, touching]);
233
+ const onGestureEnd = useCallback((e, _success) => {
230
234
  "worklet";
231
235
 
232
236
  const {
@@ -236,25 +240,40 @@ const IScrollViewGesture = props => {
236
240
  translationY
237
241
  } = e;
238
242
  scrollEndVelocity.value = isHorizontal.value ? velocityX : velocityY;
239
- scrollEndTranslation.value = isHorizontal.value ? translationX : translationY;
243
+ let panTranslation = isHorizontal.value ? translationX : translationY;
244
+ if (fixedDirection === "negative") panTranslation = -Math.abs(panTranslation);else if (fixedDirection === "positive") panTranslation = +Math.abs(panTranslation);
245
+ scrollEndTranslation.value = panTranslation;
240
246
  const totalTranslation = scrollEndVelocity.value + scrollEndTranslation.value;
247
+ /**
248
+ * If the maximum scroll distance is set and the translation `exceeds the maximum scroll distance`,
249
+ * the carousel will keep the view at the current position.
250
+ */
241
251
 
242
252
  if (maxScrollDistancePerSwipeIsSet && Math.abs(totalTranslation) > maxScrollDistancePerSwipe) {
243
253
  const nextPage = Math.round((panOffset.value + maxScrollDistancePerSwipe * Math.sign(totalTranslation)) / size) * size;
244
254
  translation.value = withSpring(withProcessTranslation(nextPage), onScrollEnd);
255
+ }
256
+ /**
257
+ * If the minimum scroll distance is set and the translation `didn't exceeds the minimum scroll distance`,
258
+ * the carousel will keep the view at the current position.
259
+ */
260
+ else if (minScrollDistancePerSwipeIsSet && Math.abs(totalTranslation) < minScrollDistancePerSwipe) {
261
+ const nextPage = Math.round((panOffset.value + minScrollDistancePerSwipe * Math.sign(totalTranslation)) / size) * size;
262
+ translation.value = withSpring(withProcessTranslation(nextPage), onScrollEnd);
245
263
  } else {
246
264
  endWithSpring(onScrollEnd);
247
265
  }
248
266
 
249
- if (!infinite) touching.value = false;
250
- }, [size, infinite, touching, panOffset, translation, isHorizontal, scrollEndVelocity, scrollEndTranslation, maxScrollDistancePerSwipeIsSet, maxScrollDistancePerSwipe, endWithSpring, withSpring, onScrollEnd]);
251
- const gesture = useMemo(() => {
252
- const gesture = Gesture.Pan().onBegin(onGestureBegin).onUpdate(onGestureUpdate).onEnd(onGestureFinish);
253
- if (onConfigurePanGesture) onConfigurePanGesture(gesture);
254
- return gesture;
255
- }, [onGestureBegin, onGestureUpdate, onGestureFinish, onConfigurePanGesture]);
256
- useUpdateGestureConfig(gesture, {
257
- enabled
267
+ if (!loop) touching.value = false;
268
+ }, [size, loop, touching, panOffset, translation, isHorizontal, scrollEndVelocity, scrollEndTranslation, fixedDirection, maxScrollDistancePerSwipeIsSet, maxScrollDistancePerSwipe, maxScrollDistancePerSwipeIsSet, minScrollDistancePerSwipe, endWithSpring, withSpring, onScrollEnd]);
269
+ const gesture = usePanGestureProxy({
270
+ onConfigurePanGesture,
271
+ onGestureStart,
272
+ onGestureUpdate,
273
+ onGestureEnd,
274
+ options: {
275
+ enabled
276
+ }
258
277
  });
259
278
  return /*#__PURE__*/React.createElement(GestureDetector, {
260
279
  gesture: gesture