react-native-reanimated-carousel 4.0.0 → 4.0.2

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 (120) hide show
  1. package/README.md +2 -40
  2. package/lib/commonjs/components/Carousel.js +1 -42
  3. package/lib/commonjs/components/Carousel.js.map +1 -1
  4. package/lib/commonjs/components/Carousel.test.js +2 -678
  5. package/lib/commonjs/components/Carousel.test.js.map +1 -1
  6. package/lib/commonjs/components/CarouselLayout.js +1 -211
  7. package/lib/commonjs/components/CarouselLayout.js.map +1 -1
  8. package/lib/commonjs/components/ItemLayout.js +1 -98
  9. package/lib/commonjs/components/ItemLayout.js.map +1 -1
  10. package/lib/commonjs/components/ItemRenderer.js +1 -79
  11. package/lib/commonjs/components/ItemRenderer.js.map +1 -1
  12. package/lib/commonjs/components/LazyView.js +1 -21
  13. package/lib/commonjs/components/LazyView.js.map +1 -1
  14. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +1 -83
  15. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +1 -1
  16. package/lib/commonjs/components/Pagination/Basic/index.js +1 -53
  17. package/lib/commonjs/components/Pagination/Basic/index.js.map +1 -1
  18. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +1 -88
  19. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +1 -1
  20. package/lib/commonjs/components/Pagination/Custom/index.js +1 -61
  21. package/lib/commonjs/components/Pagination/Custom/index.js.map +1 -1
  22. package/lib/commonjs/components/Pagination/index.js +1 -16
  23. package/lib/commonjs/components/Pagination/index.js.map +1 -1
  24. package/lib/commonjs/components/ScrollViewGesture.js +1 -362
  25. package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
  26. package/lib/commonjs/components/rnr-demo.test.js +1 -44
  27. package/lib/commonjs/components/rnr-demo.test.js.map +1 -1
  28. package/lib/commonjs/constants/index.js +1 -21
  29. package/lib/commonjs/constants/index.js.map +1 -1
  30. package/lib/commonjs/hooks/useAutoPlay.js +1 -56
  31. package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
  32. package/lib/commonjs/hooks/useAutoPlay.test.js +1 -154
  33. package/lib/commonjs/hooks/useAutoPlay.test.js.map +1 -1
  34. package/lib/commonjs/hooks/useCarouselController.js +1 -301
  35. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  36. package/lib/commonjs/hooks/useCarouselController.test.js +1 -456
  37. package/lib/commonjs/hooks/useCarouselController.test.js.map +1 -1
  38. package/lib/commonjs/hooks/useCheckMounted.js +1 -23
  39. package/lib/commonjs/hooks/useCheckMounted.js.map +1 -1
  40. package/lib/commonjs/hooks/useCheckMounted.test.js +1 -44
  41. package/lib/commonjs/hooks/useCheckMounted.test.js.map +1 -1
  42. package/lib/commonjs/hooks/useCommonVariables.js +1 -102
  43. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
  44. package/lib/commonjs/hooks/useCommonVariables.test.js +1 -37
  45. package/lib/commonjs/hooks/useCommonVariables.test.js.map +1 -1
  46. package/lib/commonjs/hooks/useInitProps.js +1 -78
  47. package/lib/commonjs/hooks/useInitProps.js.map +1 -1
  48. package/lib/commonjs/hooks/useInitProps.test.js +1 -126
  49. package/lib/commonjs/hooks/useInitProps.test.js.map +1 -1
  50. package/lib/commonjs/hooks/useLayoutConfig.js +1 -39
  51. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  52. package/lib/commonjs/hooks/useLayoutConfig.test.js +1 -241
  53. package/lib/commonjs/hooks/useLayoutConfig.test.js.map +1 -1
  54. package/lib/commonjs/hooks/useOffsetX.js +1 -51
  55. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  56. package/lib/commonjs/hooks/useOffsetX.test.js +2 -40
  57. package/lib/commonjs/hooks/useOffsetX.test.js.map +1 -1
  58. package/lib/commonjs/hooks/useOnProgressChange.js +1 -46
  59. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  60. package/lib/commonjs/hooks/useOnProgressChange.test.js +1 -162
  61. package/lib/commonjs/hooks/useOnProgressChange.test.js.map +1 -1
  62. package/lib/commonjs/hooks/usePanGestureProxy.js +1 -117
  63. package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
  64. package/lib/commonjs/hooks/usePanGestureProxy.test.js +1 -419
  65. package/lib/commonjs/hooks/usePanGestureProxy.test.js.map +1 -1
  66. package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -36
  67. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  68. package/lib/commonjs/hooks/useUpdateGestureConfig.js +1 -19
  69. package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
  70. package/lib/commonjs/hooks/useUpdateGestureConfig.test.js +1 -91
  71. package/lib/commonjs/hooks/useUpdateGestureConfig.test.js.map +1 -1
  72. package/lib/commonjs/hooks/useVisibleRanges.js +1 -71
  73. package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
  74. package/lib/commonjs/hooks/useVisibleRanges.test.js +7 -101
  75. package/lib/commonjs/hooks/useVisibleRanges.test.js.map +1 -1
  76. package/lib/commonjs/index.js +1 -21
  77. package/lib/commonjs/index.js.map +1 -1
  78. package/lib/commonjs/layouts/index.js +1 -20
  79. package/lib/commonjs/layouts/index.js.map +1 -1
  80. package/lib/commonjs/layouts/normal.js +1 -27
  81. package/lib/commonjs/layouts/normal.js.map +1 -1
  82. package/lib/commonjs/layouts/parallax.js +1 -38
  83. package/lib/commonjs/layouts/parallax.js.map +1 -1
  84. package/lib/commonjs/layouts/stack.js +1 -213
  85. package/lib/commonjs/layouts/stack.js.map +1 -1
  86. package/lib/commonjs/layouts/stack.test.js +3 -22
  87. package/lib/commonjs/layouts/stack.test.js.map +1 -1
  88. package/lib/commonjs/store/index.js +1 -67
  89. package/lib/commonjs/store/index.js.map +1 -1
  90. package/lib/commonjs/types.js +1 -5
  91. package/lib/commonjs/utils/compute-offset-if-data-changed.js +1 -51
  92. package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +1 -1
  93. package/lib/commonjs/utils/compute-offset-if-data-changed.test.js +1 -29
  94. package/lib/commonjs/utils/compute-offset-if-data-changed.test.js.map +1 -1
  95. package/lib/commonjs/utils/compute-offset-if-size-changed.js +1 -17
  96. package/lib/commonjs/utils/compute-offset-if-size-changed.js.map +1 -1
  97. package/lib/commonjs/utils/compute-offset-if-size-changed.test.js +1 -71
  98. package/lib/commonjs/utils/compute-offset-if-size-changed.test.js.map +1 -1
  99. package/lib/commonjs/utils/computed-with-auto-fill-data.js +1 -123
  100. package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -1
  101. package/lib/commonjs/utils/computed-with-auto-fill-data.test.js +1 -179
  102. package/lib/commonjs/utils/computed-with-auto-fill-data.test.js.map +1 -1
  103. package/lib/commonjs/utils/deal-with-animation.js +1 -20
  104. package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
  105. package/lib/commonjs/utils/deal-with-animation.test.js +1 -75
  106. package/lib/commonjs/utils/deal-with-animation.test.js.map +1 -1
  107. package/lib/commonjs/utils/handleroffset-direction.js +1 -15
  108. package/lib/commonjs/utils/handleroffset-direction.js.map +1 -1
  109. package/lib/commonjs/utils/handleroffset-direction.test.js +1 -45
  110. package/lib/commonjs/utils/handleroffset-direction.test.js.map +1 -1
  111. package/lib/commonjs/utils/index.test.js +1 -73
  112. package/lib/commonjs/utils/index.test.js.map +1 -1
  113. package/lib/commonjs/utils/log.js +1 -21
  114. package/lib/commonjs/utils/log.js.map +1 -1
  115. package/lib/commonjs/utils/log.test.js +1 -57
  116. package/lib/commonjs/utils/log.test.js.map +1 -1
  117. package/lib/module/hooks/useOnProgressChange.js +1 -1
  118. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  119. package/package.json +7 -2
  120. package/src/hooks/useOnProgressChange.ts +1 -1
@@ -1,20 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useUpdateGestureConfig = void 0;
7
-
8
- var _react = require("react");
9
-
10
- const useUpdateGestureConfig = (gesture, config) => {
11
- const {
12
- enabled
13
- } = config;
14
- (0, _react.useEffect)(() => {
15
- if (typeof enabled !== "undefined") gesture.enabled(enabled);
16
- }, [enabled, gesture]);
17
- };
18
-
19
- exports.useUpdateGestureConfig = useUpdateGestureConfig;
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.useUpdateGestureConfig=void 0;var _react=require("react");var useUpdateGestureConfig=function useUpdateGestureConfig(gesture,config){var enabled=config.enabled;(0,_react.useEffect)(function(){if(typeof enabled!=="undefined")gesture.enabled(enabled);},[enabled,gesture]);};exports.useUpdateGestureConfig=useUpdateGestureConfig;
20
2
  //# sourceMappingURL=useUpdateGestureConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useUpdateGestureConfig.ts"],"names":["useUpdateGestureConfig","gesture","config","enabled"],"mappings":";;;;;;;AAAA;;AAOO,MAAMA,sBAAsB,GAAG,CAACC,OAAD,EAAsBC,MAAtB,KAAgD;AACpF,QAAM;AAAEC,IAAAA;AAAF,MAAcD,MAApB;AAEA,wBAAU,MAAM;AACd,QAAI,OAAOC,OAAP,KAAmB,WAAvB,EAAoCF,OAAO,CAACE,OAAR,CAAgBA,OAAhB;AACrC,GAFD,EAEG,CAACA,OAAD,EAAUF,OAAV,CAFH;AAGD,CANM","sourcesContent":["import { useEffect } from \"react\";\nimport type { PanGesture } from \"react-native-gesture-handler\";\n\nexport interface GestureConfig {\n enabled?: boolean;\n}\n\nexport const useUpdateGestureConfig = (gesture: PanGesture, config: GestureConfig) => {\n const { enabled } = config;\n\n useEffect(() => {\n if (typeof enabled !== \"undefined\") gesture.enabled(enabled);\n }, [enabled, gesture]);\n};\n"]}
1
+ {"version":3,"sources":["useUpdateGestureConfig.ts"],"names":["useUpdateGestureConfig","gesture","config","enabled"],"mappings":"+FAAA,4BAOO,GAAMA,CAAAA,sBAAsB,CAAG,QAAzBA,CAAAA,sBAAyB,CAACC,OAAD,CAAsBC,MAAtB,CAAgD,CACpF,GAAQC,CAAAA,OAAR,CAAoBD,MAApB,CAAQC,OAAR,CAEA,qBAAU,UAAM,CACd,GAAI,MAAOA,CAAAA,OAAP,GAAmB,WAAvB,CAAoCF,OAAO,CAACE,OAAR,CAAgBA,OAAhB,EACrC,CAFD,CAEG,CAACA,OAAD,CAAUF,OAAV,CAFH,EAGD,CANM,C","sourcesContent":["import { useEffect } from \"react\";\nimport type { PanGesture } from \"react-native-gesture-handler\";\n\nexport interface GestureConfig {\n enabled?: boolean;\n}\n\nexport const useUpdateGestureConfig = (gesture: PanGesture, config: GestureConfig) => {\n const { enabled } = config;\n\n useEffect(() => {\n if (typeof enabled !== \"undefined\") gesture.enabled(enabled);\n }, [enabled, gesture]);\n};\n"]}
@@ -1,92 +1,2 @@
1
- "use strict";
2
-
3
- var _reactHooks = require("@testing-library/react-hooks");
4
-
5
- var _useUpdateGestureConfig = require("./useUpdateGestureConfig");
6
-
7
- describe("useUpdateGestureConfig", () => {
8
- const mockGesture = {
9
- enabled: jest.fn().mockReturnThis()
10
- };
11
- beforeEach(() => {
12
- jest.clearAllMocks();
13
- });
14
- it("should update gesture enabled state", () => {
15
- (0, _reactHooks.renderHook)(() => (0, _useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture, {
16
- enabled: true
17
- }));
18
- expect(mockGesture.enabled).toHaveBeenCalledWith(true);
19
- });
20
- it("should handle undefined enabled state", () => {
21
- (0, _reactHooks.renderHook)(() => (0, _useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture, {}));
22
- expect(mockGesture.enabled).not.toHaveBeenCalled();
23
- });
24
- it("should update when enabled state changes", () => {
25
- const {
26
- rerender
27
- } = (0, _reactHooks.renderHook)(props => (0, _useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture, props), {
28
- initialProps: {
29
- enabled: true
30
- }
31
- });
32
- expect(mockGesture.enabled).toHaveBeenCalledWith(true);
33
- rerender({
34
- enabled: false
35
- });
36
- expect(mockGesture.enabled).toHaveBeenCalledWith(false);
37
- });
38
- it("should not update when enabled state remains the same", () => {
39
- const {
40
- rerender
41
- } = (0, _reactHooks.renderHook)(props => (0, _useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture, props), {
42
- initialProps: {
43
- enabled: true
44
- }
45
- });
46
- mockGesture.enabled.mockClear();
47
- rerender({
48
- enabled: true
49
- });
50
- expect(mockGesture.enabled).not.toHaveBeenCalled();
51
- });
52
- it("should handle gesture object changes", () => {
53
- const newMockGesture = {
54
- enabled: jest.fn().mockReturnThis()
55
- };
56
- const {
57
- rerender
58
- } = (0, _reactHooks.renderHook)(_ref => {
59
- let {
60
- gesture,
61
- config
62
- } = _ref;
63
- return (0, _useUpdateGestureConfig.useUpdateGestureConfig)(gesture, config);
64
- }, {
65
- initialProps: {
66
- gesture: mockGesture,
67
- config: {
68
- enabled: true
69
- }
70
- }
71
- });
72
- expect(mockGesture.enabled).toHaveBeenCalledWith(true);
73
- rerender({
74
- gesture: newMockGesture,
75
- config: {
76
- enabled: true
77
- }
78
- });
79
- expect(newMockGesture.enabled).toHaveBeenCalledWith(true);
80
- });
81
- it("should cleanup properly on unmount", () => {
82
- const {
83
- unmount
84
- } = (0, _reactHooks.renderHook)(() => (0, _useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture, {
85
- enabled: true
86
- }));
87
- mockGesture.enabled.mockClear();
88
- unmount();
89
- expect(mockGesture.enabled).not.toHaveBeenCalled();
90
- });
91
- });
1
+ var _reactHooks=require("@testing-library/react-hooks");var _useUpdateGestureConfig=require("./useUpdateGestureConfig");describe("useUpdateGestureConfig",function(){var mockGesture={enabled:jest.fn().mockReturnThis()};beforeEach(function(){jest.clearAllMocks();});it("should update gesture enabled state",function(){(0,_reactHooks.renderHook)(function(){return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture,{enabled:true});});expect(mockGesture.enabled).toHaveBeenCalledWith(true);});it("should handle undefined enabled state",function(){(0,_reactHooks.renderHook)(function(){return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture,{});});expect(mockGesture.enabled).not.toHaveBeenCalled();});it("should update when enabled state changes",function(){var _renderHook=(0,_reactHooks.renderHook)(function(props){return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture,props);},{initialProps:{enabled:true}}),rerender=_renderHook.rerender;expect(mockGesture.enabled).toHaveBeenCalledWith(true);rerender({enabled:false});expect(mockGesture.enabled).toHaveBeenCalledWith(false);});it("should not update when enabled state remains the same",function(){var _renderHook2=(0,_reactHooks.renderHook)(function(props){return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture,props);},{initialProps:{enabled:true}}),rerender=_renderHook2.rerender;mockGesture.enabled.mockClear();rerender({enabled:true});expect(mockGesture.enabled).not.toHaveBeenCalled();});it("should handle gesture object changes",function(){var newMockGesture={enabled:jest.fn().mockReturnThis()};var _renderHook3=(0,_reactHooks.renderHook)(function(_ref){var gesture=_ref.gesture,config=_ref.config;return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(gesture,config);},{initialProps:{gesture:mockGesture,config:{enabled:true}}}),rerender=_renderHook3.rerender;expect(mockGesture.enabled).toHaveBeenCalledWith(true);rerender({gesture:newMockGesture,config:{enabled:true}});expect(newMockGesture.enabled).toHaveBeenCalledWith(true);});it("should cleanup properly on unmount",function(){var _renderHook4=(0,_reactHooks.renderHook)(function(){return(0,_useUpdateGestureConfig.useUpdateGestureConfig)(mockGesture,{enabled:true});}),unmount=_renderHook4.unmount;mockGesture.enabled.mockClear();unmount();expect(mockGesture.enabled).not.toHaveBeenCalled();});});
92
2
  //# sourceMappingURL=useUpdateGestureConfig.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useUpdateGestureConfig.test.ts"],"names":["describe","mockGesture","enabled","jest","fn","mockReturnThis","beforeEach","clearAllMocks","it","expect","toHaveBeenCalledWith","not","toHaveBeenCalled","rerender","props","initialProps","mockClear","newMockGesture","gesture","config","unmount"],"mappings":";;AAAA;;AAEA;;AAEAA,QAAQ,CAAC,wBAAD,EAA2B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B,WAAvB,EAA2C;AACzCC,MAAAA,OAAO,EAAE;AADgC,KAA3C,CADkB,CAApB;AAMAD,IAAAA,WAAW,CAACC,OAAZ,CAAoBc,SAApB;AACAI,IAAAA,OAAO;AAEPX,IAAAA,MAAM,CAACR,WAAW,CAACC,OAAb,CAAN,CAA4BS,GAA5B,CAAgCC,gBAAhC;AACD,GAXC,CAAF;AAYD,CApFO,CAAR","sourcesContent":["import { renderHook } from \"@testing-library/react-hooks\";\n\nimport { useUpdateGestureConfig } from \"./useUpdateGestureConfig\";\n\ndescribe(\"useUpdateGestureConfig\", () => {\n const mockGesture = {\n enabled: jest.fn().mockReturnThis(),\n };\n\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n it(\"should update gesture enabled state\", () => {\n renderHook(() =>\n useUpdateGestureConfig(mockGesture as any, {\n enabled: true,\n })\n );\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n });\n\n it(\"should handle undefined enabled state\", () => {\n renderHook(() => useUpdateGestureConfig(mockGesture as any, {}));\n\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n\n it(\"should update when enabled state changes\", () => {\n const { rerender } = renderHook((props) => useUpdateGestureConfig(mockGesture as any, props), {\n initialProps: { enabled: true },\n });\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n\n rerender({ enabled: false });\n expect(mockGesture.enabled).toHaveBeenCalledWith(false);\n });\n\n it(\"should not update when enabled state remains the same\", () => {\n const { rerender } = renderHook((props) => useUpdateGestureConfig(mockGesture as any, props), {\n initialProps: { enabled: true },\n });\n\n mockGesture.enabled.mockClear();\n\n rerender({ enabled: true });\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n\n it(\"should handle gesture object changes\", () => {\n const newMockGesture = {\n enabled: jest.fn().mockReturnThis(),\n };\n\n const { rerender } = renderHook(\n ({ gesture, config }) => useUpdateGestureConfig(gesture as any, config),\n {\n initialProps: {\n gesture: mockGesture,\n config: { enabled: true },\n },\n }\n );\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n\n rerender({\n gesture: newMockGesture,\n config: { enabled: true },\n });\n\n expect(newMockGesture.enabled).toHaveBeenCalledWith(true);\n });\n\n it(\"should cleanup properly on unmount\", () => {\n const { unmount } = renderHook(() =>\n useUpdateGestureConfig(mockGesture as any, {\n enabled: true,\n })\n );\n\n mockGesture.enabled.mockClear();\n unmount();\n\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n});\n"]}
1
+ {"version":3,"sources":["useUpdateGestureConfig.test.ts"],"names":["describe","mockGesture","enabled","jest","fn","mockReturnThis","beforeEach","clearAllMocks","it","expect","toHaveBeenCalledWith","not","toHaveBeenCalled","props","initialProps","rerender","mockClear","newMockGesture","gesture","config","unmount"],"mappings":"AAAA,wDAEA,gEAEAA,QAAQ,CAAC,wBAAD,CAA2B,UAAM,CACvC,GAAMC,CAAAA,WAAW,CAAG,CAClBC,OAAO,CAAEC,IAAI,CAACC,EAAL,GAAUC,cAAV,EADS,CAApB,CAIAC,UAAU,CAAC,UAAM,CACfH,IAAI,CAACI,aAAL,GACD,CAFS,CAAV,CAIAC,EAAE,CAAC,qCAAD,CAAwC,UAAM,CAC9C,2BAAW,iBACT,mDAAuBP,WAAvB,CAA2C,CACzCC,OAAO,CAAE,IADgC,CAA3C,CADS,EAAX,EAMAO,MAAM,CAACR,WAAW,CAACC,OAAb,CAAN,CAA4BQ,oBAA5B,CAAiD,IAAjD,EACD,CARC,CAAF,CAUAF,EAAE,CAAC,uCAAD,CAA0C,UAAM,CAChD,2BAAW,iBAAM,mDAAuBP,WAAvB,CAA2C,EAA3C,CAAN,EAAX,EAEAQ,MAAM,CAACR,WAAW,CAACC,OAAb,CAAN,CAA4BS,GAA5B,CAAgCC,gBAAhC,GACD,CAJC,CAAF,CAMAJ,EAAE,CAAC,0CAAD,CAA6C,UAAM,CACnD,gBAAqB,2BAAW,SAACK,KAAD,QAAW,mDAAuBZ,WAAvB,CAA2CY,KAA3C,CAAX,EAAX,CAAyE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jD,EAEAK,QAAQ,CAAC,CACPG,OAAO,CAAED,cADF,CAEPE,MAAM,CAAE,CAAEjB,OAAO,CAAE,IAAX,CAFD,CAAD,CAAR,CAKAO,MAAM,CAACQ,cAAc,CAACf,OAAhB,CAAN,CAA+BQ,oBAA/B,CAAoD,IAApD,EACD,CAvBC,CAAF,CAyBAF,EAAE,CAAC,oCAAD,CAAuC,UAAM,CAC7C,iBAAoB,2BAAW,iBAC7B,mDAAuBP,WAAvB,CAA2C,CACzCC,OAAO,CAAE,IADgC,CAA3C,CAD6B,EAAX,CAApB,CAAQkB,OAAR,cAAQA,OAAR,CAMAnB,WAAW,CAACC,OAAZ,CAAoBc,SAApB,GACAI,OAAO,GAEPX,MAAM,CAACR,WAAW,CAACC,OAAb,CAAN,CAA4BS,GAA5B,CAAgCC,gBAAhC,GACD,CAXC,CAAF,CAYD,CApFO,CAAR","sourcesContent":["import { renderHook } from \"@testing-library/react-hooks\";\n\nimport { useUpdateGestureConfig } from \"./useUpdateGestureConfig\";\n\ndescribe(\"useUpdateGestureConfig\", () => {\n const mockGesture = {\n enabled: jest.fn().mockReturnThis(),\n };\n\n beforeEach(() => {\n jest.clearAllMocks();\n });\n\n it(\"should update gesture enabled state\", () => {\n renderHook(() =>\n useUpdateGestureConfig(mockGesture as any, {\n enabled: true,\n })\n );\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n });\n\n it(\"should handle undefined enabled state\", () => {\n renderHook(() => useUpdateGestureConfig(mockGesture as any, {}));\n\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n\n it(\"should update when enabled state changes\", () => {\n const { rerender } = renderHook((props) => useUpdateGestureConfig(mockGesture as any, props), {\n initialProps: { enabled: true },\n });\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n\n rerender({ enabled: false });\n expect(mockGesture.enabled).toHaveBeenCalledWith(false);\n });\n\n it(\"should not update when enabled state remains the same\", () => {\n const { rerender } = renderHook((props) => useUpdateGestureConfig(mockGesture as any, props), {\n initialProps: { enabled: true },\n });\n\n mockGesture.enabled.mockClear();\n\n rerender({ enabled: true });\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n\n it(\"should handle gesture object changes\", () => {\n const newMockGesture = {\n enabled: jest.fn().mockReturnThis(),\n };\n\n const { rerender } = renderHook(\n ({ gesture, config }) => useUpdateGestureConfig(gesture as any, config),\n {\n initialProps: {\n gesture: mockGesture,\n config: { enabled: true },\n },\n }\n );\n\n expect(mockGesture.enabled).toHaveBeenCalledWith(true);\n\n rerender({\n gesture: newMockGesture,\n config: { enabled: true },\n });\n\n expect(newMockGesture.enabled).toHaveBeenCalledWith(true);\n });\n\n it(\"should cleanup properly on unmount\", () => {\n const { unmount } = renderHook(() =>\n useUpdateGestureConfig(mockGesture as any, {\n enabled: true,\n })\n );\n\n mockGesture.enabled.mockClear();\n unmount();\n\n expect(mockGesture.enabled).not.toHaveBeenCalled();\n });\n});\n"]}
@@ -1,72 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useVisibleRanges = useVisibleRanges;
7
-
8
- var _react = require("react");
9
-
10
- var _reactNativeReanimated = require("react-native-reanimated");
11
-
12
- function useVisibleRanges(options) {
13
- const {
14
- total = 0,
15
- viewSize,
16
- translation,
17
- windowSize: _windowSize,
18
- loop
19
- } = options;
20
- const windowSize = _windowSize !== null && _windowSize !== void 0 ? _windowSize : total;
21
- const cachedRanges = (0, _react.useRef)(null);
22
- const ranges = (0, _reactNativeReanimated.useDerivedValue)(() => {
23
- var _cachedRanges$current, _cachedRanges$current2, _cachedRanges$current3, _cachedRanges$current4;
24
-
25
- const positiveCount = Math.round(windowSize / 2);
26
- const negativeCount = windowSize - positiveCount;
27
- let currentIndex = Math.round(-translation.value / viewSize);
28
- currentIndex = currentIndex < 0 ? currentIndex % total + total : currentIndex;
29
- let newRanges;
30
-
31
- if (!loop) {
32
- // Adjusting negative range if the carousel is not loopable.
33
- // So, It will be only displayed the positive items.
34
- newRanges = {
35
- negativeRange: [0 + currentIndex - (windowSize - 1), 0 + currentIndex],
36
- positiveRange: [0 + currentIndex, currentIndex + (windowSize - 1)]
37
- };
38
- } else {
39
- const negativeRange = [(currentIndex - negativeCount + total) % total, (currentIndex - 1 + total) % total];
40
- const positiveRange = [(currentIndex + total) % total, (currentIndex + positiveCount + total) % total];
41
-
42
- if (negativeRange[0] < total && negativeRange[0] > negativeRange[1]) {
43
- negativeRange[1] = total - 1;
44
- positiveRange[0] = 0;
45
- }
46
-
47
- if (positiveRange[0] > positiveRange[1]) {
48
- negativeRange[1] = total - 1;
49
- positiveRange[0] = 0;
50
- } // console.log({ negativeRange, positiveRange ,total,windowSize,a:total <= _windowSize})
51
-
52
-
53
- newRanges = {
54
- negativeRange,
55
- positiveRange
56
- };
57
- }
58
-
59
- if (isArraysEqual((_cachedRanges$current = (_cachedRanges$current2 = cachedRanges.current) === null || _cachedRanges$current2 === void 0 ? void 0 : _cachedRanges$current2.negativeRange) !== null && _cachedRanges$current !== void 0 ? _cachedRanges$current : [], newRanges.negativeRange) && isArraysEqual((_cachedRanges$current3 = (_cachedRanges$current4 = cachedRanges.current) === null || _cachedRanges$current4 === void 0 ? void 0 : _cachedRanges$current4.positiveRange) !== null && _cachedRanges$current3 !== void 0 ? _cachedRanges$current3 : [], newRanges.positiveRange)) return cachedRanges.current;
60
- cachedRanges.current = newRanges;
61
- return cachedRanges.current;
62
- }, [loop, total, windowSize, translation]);
63
- return ranges;
64
- }
65
-
66
- function isArraysEqual(a, b) {
67
- "worklet";
68
-
69
- if (a.length !== b.length) return false;
70
- return a.every((value, index) => value === b[index]);
71
- }
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.useVisibleRanges=useVisibleRanges;var _react=require("react");var _reactNativeReanimated=require("react-native-reanimated");var _worklet_11864648947888_init_data={code:"function anonymous(){const{windowSize,translation,viewSize,total,loop,isArraysEqual,cachedRanges}=this.__closure;var _cachedRanges$current,_cachedRanges$current2,_cachedRanges$current3,_cachedRanges$current4;const positiveCount=Math.round(windowSize/2);const negativeCount=windowSize-positiveCount;let currentIndex=Math.round(-translation.value/viewSize);currentIndex=currentIndex<0?currentIndex%total+total:currentIndex;let newRanges;if(!loop){newRanges={negativeRange:[0+currentIndex-(windowSize-1),0+currentIndex],positiveRange:[0+currentIndex,currentIndex+(windowSize-1)]};}else{const negativeRange=[(currentIndex-negativeCount+total)%total,(currentIndex-1+total)%total];const positiveRange=[(currentIndex+total)%total,(currentIndex+positiveCount+total)%total];if(negativeRange[0]<total&&negativeRange[0]>negativeRange[1]){negativeRange[1]=total-1;positiveRange[0]=0;}if(positiveRange[0]>positiveRange[1]){negativeRange[1]=total-1;positiveRange[0]=0;}newRanges={negativeRange:negativeRange,positiveRange:positiveRange};}if(isArraysEqual((_cachedRanges$current=(_cachedRanges$current2=cachedRanges.current)===null||_cachedRanges$current2===void 0?void 0:_cachedRanges$current2.negativeRange)!==null&&_cachedRanges$current!==void 0?_cachedRanges$current:[],newRanges.negativeRange)&&isArraysEqual((_cachedRanges$current3=(_cachedRanges$current4=cachedRanges.current)===null||_cachedRanges$current4===void 0?void 0:_cachedRanges$current4.positiveRange)!==null&&_cachedRanges$current3!==void 0?_cachedRanges$current3:[],newRanges.positiveRange))return cachedRanges.current;cachedRanges.current=newRanges;return cachedRanges.current;}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AAyBiC,QAAAA,UAAA,EAAM,gGAAAC,sBAAA,CAAAC,sBAAA,CAAAC,sBAAA,CAAAC,sBAAA,8CACnC,KAAMC,cAAa,CAAGC,WAAWC,aAAjC,CACA,GAAAC,aAAMC,CAAaH,IAAGC,MAAH,CAAGA,YAAaF,MAAbE,CAAtBG,QAAmB,CAAnB,CAEAF,YAAIA,aAAoBG,CAAM,CAA1BH,CAA2BI,YAAYC,CAAbC,KAACF,CAAoBF,KAA/CF,CAAJA,YAAA,CACAA,cAEA,GAAIO,KAAJ,CAAIA,CAGFA,SAAA,EACAC,aAAA,IAAAR,YAAA,EAAAD,UAAA,MAAAC,YAAA,CADA,CAEAO,aAAY,IAAAP,YAAA,CAAAA,YAAA,EAAAD,UAAA,IAFZ,EAIEU,CAPJ,IAOIA,CAFU,KAAZF,sFAAY,CAHd,KAOOE,cAAA,GAAAT,YAAA,CAAAM,KAAA,EAAAA,KAAA,EAAAN,YAAA,CAAAH,aAAA,CAAAS,KAAA,EAAAA,KAAA,CAPP,CAQE,GAAAE,aAAMA,GAAN,CACEF,KADF,EACGN,aAAeC,GAAfD,CAAeC,aAAyBK,GAD3C,CAA6B,CAK7BE,aAAMC,GAAN,CAA0BH,KACvBN,EADH,oBAKA,CACEQ,gBAAa,CAAbA,CAAa,CAAbA,CAAmBF,aAAnBE,KACAC,aAAa,CAAC,CAAD,CAAbA,CAAmBH,KAAnBG,GACFA,aAAA,OAGEA,WAGFD,aAAA,CAAAA,aAHEC,8BAIFF,CAAcC,gBAAa,EAAbA,qBAAF,EAAAd,sBAAA,CAAAgB,YAAA,CAAAC,OAAA,UAAAjB,sBAAA,iBAAAA,sBAAA,CAAAc,aAAe,IAAf,IAAe,EAAff,qBAAA,SAAe,CAAfA,qBAAe,CAAf,EAAe,CAAfc,SAAA,CAAAC,aAAe,CAAbA,EAAFI,aAAA,EAAAjB,sBAAA,EAAAC,sBAAA,CAAAc,YAAA,CAAAC,OAAA,UAAAf,sBAAA,iBAAAA,sBAAA,CAAAa,aAAA,UAAAd,sBAAA,UAAAA,sBAAA,IAAAY,SAAA,CAAAE,aAAA,CAAED,CAAF,MAAAE,aAAA,CAAAC,OAAA,CAAiBF,+BAAjB,MAAZF,qBAAY,CACd\",\"names\":[\"anonymous\",\"_cachedRanges$current\",\"_cachedRanges$current2\",\"_cachedRanges$current3\",\"_cachedRanges$current4\",\"positiveCount\",\"Math\",\"windowSize\",\"currentIndex\",\"negativeCount\",\"viewSize\",\"round\",\"translation\",\"value\",\"total\",\"newRanges\",\"negativeRange\",\"positiveRange\",\"cachedRanges\",\"current\",\"isArraysEqual\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx\"]}",version:"3.10.1"};function useVisibleRanges(options){var _options$total=options.total,total=_options$total===void 0?0:_options$total,viewSize=options.viewSize,translation=options.translation,_windowSize=options.windowSize,loop=options.loop;var windowSize=_windowSize!=null?_windowSize:total;var cachedRanges=(0,_react.useRef)(null);var ranges=(0,_reactNativeReanimated.useDerivedValue)(function(){var _e=[new global.Error(),-8,-27];var anonymous=function anonymous(){var _cachedRanges$current,_cachedRanges$current2,_cachedRanges$current3,_cachedRanges$current4;var positiveCount=Math.round(windowSize/2);var negativeCount=windowSize-positiveCount;var currentIndex=Math.round(-translation.value/viewSize);currentIndex=currentIndex<0?currentIndex%total+total:currentIndex;var newRanges;if(!loop){newRanges={negativeRange:[0+currentIndex-(windowSize-1),0+currentIndex],positiveRange:[0+currentIndex,currentIndex+(windowSize-1)]};}else{var negativeRange=[(currentIndex-negativeCount+total)%total,(currentIndex-1+total)%total];var positiveRange=[(currentIndex+total)%total,(currentIndex+positiveCount+total)%total];if(negativeRange[0]<total&&negativeRange[0]>negativeRange[1]){negativeRange[1]=total-1;positiveRange[0]=0;}if(positiveRange[0]>positiveRange[1]){negativeRange[1]=total-1;positiveRange[0]=0;}newRanges={negativeRange:negativeRange,positiveRange:positiveRange};}if(isArraysEqual((_cachedRanges$current=(_cachedRanges$current2=cachedRanges.current)==null?void 0:_cachedRanges$current2.negativeRange)!=null?_cachedRanges$current:[],newRanges.negativeRange)&&isArraysEqual((_cachedRanges$current3=(_cachedRanges$current4=cachedRanges.current)==null?void 0:_cachedRanges$current4.positiveRange)!=null?_cachedRanges$current3:[],newRanges.positiveRange))return cachedRanges.current;cachedRanges.current=newRanges;return cachedRanges.current;};anonymous.__closure={windowSize:windowSize,translation:translation,viewSize:viewSize,total:total,loop:loop,isArraysEqual:isArraysEqual,cachedRanges:cachedRanges};anonymous.__workletHash=11864648947888;anonymous.__initData=_worklet_11864648947888_init_data;anonymous.__stackDetails=_e;return anonymous;}(),[loop,total,windowSize,translation]);return ranges;}var _worklet_6577523793522_init_data={code:"function isArraysEqual(a,b){if(a.length!==b.length)return false;return a.every(function(value,index){return value===b[index];});}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx",sourceMap:"{\"version\":3,\"mappings\":\"AA8EA,QAAAA,cAAA,CAAAC,CAAA,CAAAC,CAAA,EAEE,GAAID,CAAC,CAACE,MAAFF,GAAaC,CAAC,CAACC,MAAnB,CAA2B,MAAO,MAAP,CAE3B,MAAOF,EAAC,CAACG,KAAFH,CAAQ,SAACI,KAAD,CAAQC,KAAR,QAAkBD,MAAK,GAAKH,CAAC,CAACI,KAAD,CAA7B,CAARL,EAAP,CAJF\",\"names\":[\"isArraysEqual\",\"a\",\"b\",\"length\",\"every\",\"value\",\"index\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx\"]}",version:"3.10.1"};var isArraysEqual=function(){var _e=[new global.Error(),1,-27];var isArraysEqual=function isArraysEqual(a,b){if(a.length!==b.length)return false;return a.every(function(value,index){return value===b[index];});};isArraysEqual.__closure={};isArraysEqual.__workletHash=6577523793522;isArraysEqual.__initData=_worklet_6577523793522_init_data;isArraysEqual.__stackDetails=_e;return isArraysEqual;}();
72
2
  //# sourceMappingURL=useVisibleRanges.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useVisibleRanges.tsx"],"names":["useVisibleRanges","options","total","viewSize","translation","windowSize","_windowSize","loop","cachedRanges","ranges","positiveCount","Math","round","negativeCount","currentIndex","value","newRanges","negativeRange","positiveRange","isArraysEqual","current","a","b","length","every","index"],"mappings":";;;;;;;AAAA;;AAEA;;AAWO,SAASA,gBAAT,CAA0BC,OAA1B,EAMY;AACjB,QAAM;AAAEC,IAAAA,KAAK,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K,KAAKO,CAAC,CAACG,KAAD,CAArC,CAAP;AACD","sourcesContent":["import { useRef } from \"react\";\nimport type Animated from \"react-native-reanimated\";\nimport { useDerivedValue } from \"react-native-reanimated\";\n\ntype Range = [number, number];\n\nexport interface VisibleRanges {\n negativeRange: Range;\n positiveRange: Range;\n}\n\nexport type IVisibleRanges = Animated.SharedValue<VisibleRanges>;\n\nexport function useVisibleRanges(options: {\n total: number;\n viewSize: number;\n windowSize?: number;\n translation: Animated.SharedValue<number>;\n loop?: boolean;\n}): IVisibleRanges {\n const { total = 0, viewSize, translation, windowSize: _windowSize, loop } = options;\n\n const windowSize = _windowSize ?? total;\n const cachedRanges = useRef<VisibleRanges>(null!);\n\n const ranges = useDerivedValue(() => {\n const positiveCount = Math.round(windowSize / 2);\n const negativeCount = windowSize - positiveCount;\n\n let currentIndex = Math.round(-translation.value / viewSize);\n currentIndex = currentIndex < 0 ? (currentIndex % total) + total : currentIndex;\n\n let newRanges: VisibleRanges;\n\n if (!loop) {\n // Adjusting negative range if the carousel is not loopable.\n // So, It will be only displayed the positive items.\n newRanges = {\n negativeRange: [0 + currentIndex - (windowSize - 1), 0 + currentIndex],\n positiveRange: [0 + currentIndex, currentIndex + (windowSize - 1)],\n };\n } else {\n const negativeRange: Range = [\n (currentIndex - negativeCount + total) % total,\n (currentIndex - 1 + total) % total,\n ];\n\n const positiveRange: Range = [\n (currentIndex + total) % total,\n (currentIndex + positiveCount + total) % total,\n ];\n\n if (negativeRange[0] < total && negativeRange[0] > negativeRange[1]) {\n negativeRange[1] = total - 1;\n positiveRange[0] = 0;\n }\n if (positiveRange[0] > positiveRange[1]) {\n negativeRange[1] = total - 1;\n positiveRange[0] = 0;\n }\n\n // console.log({ negativeRange, positiveRange ,total,windowSize,a:total <= _windowSize})\n newRanges = { negativeRange, positiveRange };\n }\n\n if (\n isArraysEqual(cachedRanges.current?.negativeRange ?? [], newRanges.negativeRange) &&\n isArraysEqual(cachedRanges.current?.positiveRange ?? [], newRanges.positiveRange)\n )\n return cachedRanges.current;\n\n cachedRanges.current = newRanges;\n return cachedRanges.current;\n }, [loop, total, windowSize, translation]);\n\n return ranges;\n}\n\nfunction isArraysEqual(a: number[], b: number[]): boolean {\n \"worklet\";\n if (a.length !== b.length) return false;\n\n return a.every((value, index) => value === b[index]);\n}\n"]}
1
+ {"version":3,"sources":["useVisibleRanges.tsx"],"names":["useVisibleRanges","options","total","viewSize","translation","_windowSize","windowSize","loop","cachedRanges","ranges","positiveCount","Math","round","negativeCount","currentIndex","value","newRanges","negativeRange","positiveRange","isArraysEqual","current","a","b","length","every","index"],"mappings":"mGAAA,4BAEA,8D,o8GAWO,QAASA,CAAAA,gBAAT,CAA0BC,OAA1B,CAMY,CACjB,mBAA4EA,OAA5E,CAAQC,KAAR,CAAQA,KAAR,yBAAgB,CAAhB,gBAAmBC,QAAnB,CAA4EF,OAA5E,CAAmBE,QAAnB,CAA6BC,WAA7B,CAA4EH,OAA5E,CAA6BG,WAA7B,CAAsDC,WAAtD,CAA4EJ,OAA5E,CAA0CK,UAA1C,CAAmEC,IAAnE,CAA4EN,OAA5E,CAAmEM,IAAnE,CAEA,GAAMD,CAAAA,UAAU,CAAGD,WAAH,OAAGA,WAAH,CAAkBH,KAAlC,CACA,GAAMM,CAAAA,YAAY,CAAG,kBAAsB,IAAtB,CAArB,CAEA,GAAMC,CAAAA,MAAM,CAAG,2CAAgB,gFAAM,gGACnC,GAAMC,CAAAA,aAAa,CAAGC,IAAI,CAACC,KAAL,CAAWN,UAAU,CAAG,CAAxB,CAAtB,CACA,GAAMO,CAAAA,aAAa,CAAGP,UAAU,CAAGI,aAAnC,CAEA,GAAII,CAAAA,YAAY,CAAGH,IAAI,CAACC,KAAL,CAAW,CAACR,WAAW,CAACW,KAAb,CAAqBZ,QAAhC,CAAnB,CACAW,YAAY,CAAGA,YAAY,CAAG,CAAf,CAAoBA,YAAY,CAAGZ,KAAhB,CAAyBA,KAA5C,CAAoDY,YAAnE,CAEA,GAAIE,CAAAA,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,YAAY,CAACY,OAAd,eAAC,uBAAsBF,aAAvB,+BAAwC,EAAxC,CAA4CF,SAAS,CAACE,aAAtD,CAFf,CAIE,MAAOV,CAAAA,YAAY,CAACY,OAApB,CAEFZ,YAAY,CAACY,OAAb,CAAuBJ,SAAvB,CACA,MAAOR,CAAAA,YAAY,CAACY,OAApB,CACD,CAhD8B,iCACId,UADJ,aAIEF,WAJF,UAIsBD,QAJtB,OAKqBD,KALrB,MASxBK,IATwB,eAyC3BY,aAzC2B,cAyCbX,YAzCa,8IAAhB,GAgDZ,CAACD,IAAD,CAAOL,KAAP,CAAcI,UAAd,CAA0BF,WAA1B,CAhDY,CAAf,CAkDA,MAAOK,CAAAA,MAAP,CACD,C,iyBAEQU,CAAAA,a,CAAT,sFAAuBE,CAAvB,CAAoCC,CAApC,CAA0D,CAExD,GAAID,CAAC,CAACE,MAAF,GAAaD,CAAC,CAACC,MAAnB,CAA2B,MAAO,MAAP,CAE3B,MAAOF,CAAAA,CAAC,CAACG,KAAF,CAAQ,SAACT,KAAD,CAAQU,KAAR,QAAkBV,CAAAA,KAAK,GAAKO,CAAC,CAACG,KAAD,CAA7B,EAAR,CAAP,CACD,CALD,sL","sourcesContent":["import { useRef } from \"react\";\nimport type Animated from \"react-native-reanimated\";\nimport { useDerivedValue } from \"react-native-reanimated\";\n\ntype Range = [number, number];\n\nexport interface VisibleRanges {\n negativeRange: Range;\n positiveRange: Range;\n}\n\nexport type IVisibleRanges = Animated.SharedValue<VisibleRanges>;\n\nexport function useVisibleRanges(options: {\n total: number;\n viewSize: number;\n windowSize?: number;\n translation: Animated.SharedValue<number>;\n loop?: boolean;\n}): IVisibleRanges {\n const { total = 0, viewSize, translation, windowSize: _windowSize, loop } = options;\n\n const windowSize = _windowSize ?? total;\n const cachedRanges = useRef<VisibleRanges>(null!);\n\n const ranges = useDerivedValue(() => {\n const positiveCount = Math.round(windowSize / 2);\n const negativeCount = windowSize - positiveCount;\n\n let currentIndex = Math.round(-translation.value / viewSize);\n currentIndex = currentIndex < 0 ? (currentIndex % total) + total : currentIndex;\n\n let newRanges: VisibleRanges;\n\n if (!loop) {\n // Adjusting negative range if the carousel is not loopable.\n // So, It will be only displayed the positive items.\n newRanges = {\n negativeRange: [0 + currentIndex - (windowSize - 1), 0 + currentIndex],\n positiveRange: [0 + currentIndex, currentIndex + (windowSize - 1)],\n };\n } else {\n const negativeRange: Range = [\n (currentIndex - negativeCount + total) % total,\n (currentIndex - 1 + total) % total,\n ];\n\n const positiveRange: Range = [\n (currentIndex + total) % total,\n (currentIndex + positiveCount + total) % total,\n ];\n\n if (negativeRange[0] < total && negativeRange[0] > negativeRange[1]) {\n negativeRange[1] = total - 1;\n positiveRange[0] = 0;\n }\n if (positiveRange[0] > positiveRange[1]) {\n negativeRange[1] = total - 1;\n positiveRange[0] = 0;\n }\n\n // console.log({ negativeRange, positiveRange ,total,windowSize,a:total <= _windowSize})\n newRanges = { negativeRange, positiveRange };\n }\n\n if (\n isArraysEqual(cachedRanges.current?.negativeRange ?? [], newRanges.negativeRange) &&\n isArraysEqual(cachedRanges.current?.positiveRange ?? [], newRanges.positiveRange)\n )\n return cachedRanges.current;\n\n cachedRanges.current = newRanges;\n return cachedRanges.current;\n }, [loop, total, windowSize, translation]);\n\n return ranges;\n}\n\nfunction isArraysEqual(a: number[], b: number[]): boolean {\n \"worklet\";\n if (a.length !== b.length) return false;\n\n return a.every((value, index) => value === b[index]);\n}\n"]}
@@ -1,27 +1,4 @@
1
- "use strict";
2
-
3
- var _reactNativeReanimated = require("react-native-reanimated");
4
-
5
- var _reactHooks = require("@testing-library/react-hooks");
6
-
7
- var _useVisibleRanges = require("./useVisibleRanges");
8
-
9
- const viewSize = 393;
10
- describe("useVisibleRanges", () => {
11
- it("should only display the front of the list when loop is false", async () => {
12
- const hook = (0, _reactHooks.renderHook)(() => {
13
- const translation = (0, _reactNativeReanimated.useSharedValue)(-0);
14
- const range = (0, _useVisibleRanges.useVisibleRanges)({
15
- total: 10,
16
- translation,
17
- viewSize,
18
- windowSize: 4,
19
- loop: false
20
- });
21
- return range;
22
- });
23
- const expected = hook.result.current.value;
24
- expect(expected).toMatchInlineSnapshot(`
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _asyncToGenerator2=_interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));var _reactNativeReanimated=require("react-native-reanimated");var _reactHooks=require("@testing-library/react-hooks");var _useVisibleRanges=require("./useVisibleRanges");var viewSize=393;describe("useVisibleRanges",function(){it("should only display the front of the list when loop is false",(0,_asyncToGenerator2.default)(function*(){var hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-0);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:false});return range;});var expected=hook.result.current.value;expect(expected).toMatchInlineSnapshot(`
25
2
  {
26
3
  "negativeRange": [
27
4
  -3,
@@ -32,22 +9,7 @@ describe("useVisibleRanges", () => {
32
9
  3,
33
10
  ],
34
11
  }
35
- `);
36
- });
37
- it("should display the rear of the list and the front of the list when loop is true", async () => {
38
- const hook = (0, _reactHooks.renderHook)(() => {
39
- const translation = (0, _reactNativeReanimated.useSharedValue)(-0);
40
- const range = (0, _useVisibleRanges.useVisibleRanges)({
41
- total: 10,
42
- translation,
43
- viewSize,
44
- windowSize: 4,
45
- loop: true
46
- });
47
- return range;
48
- });
49
- const expected = hook.result.current.value;
50
- expect(expected).toMatchInlineSnapshot(`
12
+ `);}));it("should display the rear of the list and the front of the list when loop is true",(0,_asyncToGenerator2.default)(function*(){var hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-0);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:true});return range;});var expected=hook.result.current.value;expect(expected).toMatchInlineSnapshot(`
51
13
  {
52
14
  "negativeRange": [
53
15
  8,
@@ -58,55 +20,7 @@ describe("useVisibleRanges", () => {
58
20
  2,
59
21
  ],
60
22
  }
61
- `);
62
- });
63
- it("should shows the increased range of the list when the loop is false and swiped the carousel.", async () => {
64
- const slide0hook = (0, _reactHooks.renderHook)(() => {
65
- const translation = (0, _reactNativeReanimated.useSharedValue)(-0 * viewSize);
66
- const range = (0, _useVisibleRanges.useVisibleRanges)({
67
- total: 10,
68
- translation,
69
- viewSize,
70
- windowSize: 4,
71
- loop: false
72
- });
73
- return range;
74
- }).result.current.value;
75
- const slide1hook = (0, _reactHooks.renderHook)(() => {
76
- const translation = (0, _reactNativeReanimated.useSharedValue)(-1 * viewSize);
77
- const range = (0, _useVisibleRanges.useVisibleRanges)({
78
- total: 10,
79
- translation,
80
- viewSize,
81
- windowSize: 4,
82
- loop: false
83
- });
84
- return range;
85
- }).result.current.value;
86
- const slide2hook = (0, _reactHooks.renderHook)(() => {
87
- const translation = (0, _reactNativeReanimated.useSharedValue)(-2 * viewSize);
88
- const range = (0, _useVisibleRanges.useVisibleRanges)({
89
- total: 10,
90
- translation,
91
- viewSize,
92
- windowSize: 4,
93
- loop: false
94
- });
95
- return range;
96
- }).result.current.value;
97
- const slide3hook = (0, _reactHooks.renderHook)(() => {
98
- const translation = (0, _reactNativeReanimated.useSharedValue)(-3 * viewSize);
99
- const range = (0, _useVisibleRanges.useVisibleRanges)({
100
- total: 10,
101
- translation,
102
- viewSize,
103
- windowSize: 4,
104
- loop: false
105
- });
106
- return range;
107
- }).result.current.value; // [0,3] Display the 0,1,2,3 items.
108
-
109
- expect(slide0hook).toMatchInlineSnapshot(`
23
+ `);}));it("should shows the increased range of the list when the loop is false and swiped the carousel.",(0,_asyncToGenerator2.default)(function*(){var slide0hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-0*viewSize);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:false});return range;}).result.current.value;var slide1hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-1*viewSize);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:false});return range;}).result.current.value;var slide2hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-2*viewSize);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:false});return range;}).result.current.value;var slide3hook=(0,_reactHooks.renderHook)(function(){var translation=(0,_reactNativeReanimated.useSharedValue)(-3*viewSize);var range=(0,_useVisibleRanges.useVisibleRanges)({total:10,translation:translation,viewSize:viewSize,windowSize:4,loop:false});return range;}).result.current.value;expect(slide0hook).toMatchInlineSnapshot(`
110
24
  {
111
25
  "negativeRange": [
112
26
  -3,
@@ -117,9 +31,7 @@ describe("useVisibleRanges", () => {
117
31
  3,
118
32
  ],
119
33
  }
120
- `); // [1,4] Display the 1,2,3,4 items.
121
-
122
- expect(slide1hook).toMatchInlineSnapshot(`
34
+ `);expect(slide1hook).toMatchInlineSnapshot(`
123
35
  {
124
36
  "negativeRange": [
125
37
  -2,
@@ -130,9 +42,7 @@ describe("useVisibleRanges", () => {
130
42
  4,
131
43
  ],
132
44
  }
133
- `); // [2,5] Display the 2,3,4,5 items.
134
-
135
- expect(slide2hook).toMatchInlineSnapshot(`
45
+ `);expect(slide2hook).toMatchInlineSnapshot(`
136
46
  {
137
47
  "negativeRange": [
138
48
  -1,
@@ -143,9 +53,7 @@ describe("useVisibleRanges", () => {
143
53
  5,
144
54
  ],
145
55
  }
146
- `); // [3.6] Display the 3,4,5,6 items.
147
-
148
- expect(slide3hook).toMatchInlineSnapshot(`
56
+ `);expect(slide3hook).toMatchInlineSnapshot(`
149
57
  {
150
58
  "negativeRange": [
151
59
  0,
@@ -156,7 +64,5 @@ describe("useVisibleRanges", () => {
156
64
  6,
157
65
  ],
158
66
  }
159
- `);
160
- });
161
- });
67
+ `);}));});
162
68
  //# sourceMappingURL=useVisibleRanges.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useVisibleRanges.test.tsx"],"names":["viewSize","describe","it","hook","translation","range","total","windowSize","loop","expected","result","current","value","expect","toMatchInlineSnapshot","slide0hook","slide1hook","slide2hook","slide3hook"],"mappings":";;AAAA;;AAEA;;AAEA;;AAEA,MAAMA,QAAQ,GAAG,GAAjB;AAEAC,QAAQ,CAAC,kBAAD,EAAqB,MAAM;AACjCC,EAAAA,EAAE,CAAC,8DAAD,EAAiE,YAAY;AAC7E,UAAMC,IAAI,GAAG,4BAAW,MAAM;AAC5B,YAAMC,WAAW,GAAG,2CAAe,CAAC,CAAhB,CAApB;AACA,YAAMC,KAAK,GAAG,wCAAiB;AAC7BC,QAAAA,KAAK,EAAE,EADsB;AAE7BF,QAAAA,WAF6B;AAG7BJ,QAAAA,QAH6B;AAI7BO,QAAAA,UAAU,EAAE,CAJiB;AAK7BC,QAAAA,IAAI,EAAE;AALuB,OAAjB,CAAd;AAQA,aAAOH,KAAP;AACD,KAXY,CAAb;AAaA,UAAMI,QAAQ,GAAGN,IAAI,CAACO,MAAL,CAAYC,OAAZ,CAAoBC,KAArC;AAEAC,IAAAA,MAAM,CAACJ,QAAD,CAAN,CAAiBK,qBAAjB,CAAwC;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI;AAYD,GA5BC,CAAF;AA8BAZ,EAAAA,EAAE,CAAC,iFAAD,EAAoF,YAAY;AAChG,UAAMC,IAAI,GAAG,4BAAW,MAAM;AAC5B,YAAMC,WAAW,GAAG,2CAAe,CAAC,CAAhB,CAApB;AACA,YAAMC,KAAK,GAAG,wCAAiB;AAC7BC,QAAAA,KAAK,EAAE,EADsB;AAE7BF,QAAAA,WAF6B;AAG7BJ,QAAAA,QAH6B;AAI7BO,QAAAA,UAAU,EAAE,CAJiB;AAK7BC,QAAAA,IAAI,EAAE;AALuB,OAAjB,CAAd;AAQA,aAAOH,KAAP;AACD,KAXY,CAAb;AAaA,UAAMI,QAAQ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AAU,EAAE,CAJiB;AAK7BC,QAAAA,IAAI,EAAE;AALuB,OAAjB,CAAd;AAQA,aAAOH,KAAP;AACD,KAXkB,EAWhBK,MAXgB,CAWTC,OAXS,CAWDC,KAXlB;AAaA,UAAMM,UAAU,GAAG,4BAAW,MAAM;AAClC,YAAMd,WAAW,GAAG,2CAAe,CAAC,CAAD,GAAKJ,QAApB,CAApB;AACA,YAAMK,KAAK,GAAG,wCAAiB;AAC7BC,QAAAA,KAAK,EAAE,EADsB;AAE7BF,QAAAA,WAF6B;AAG7BJ,QAAAA,QAH6B;AAI7BO,QAAAA,UAAU,EAAE,CAJiB;AAK7BC,QAAAA,IAAI,EAAE;AALuB,OAAjB,CAAd;AAQA,aAAOH,KAAP;AACD,KAXkB,EAWhBK,MAXgB,CAWTC,OAXS,CAWDC,KAXlB,CAxC6G,CAqD7G;;AACAC,IAAAA,MAAM,CAACE,UAAD,CAAN,CAAmBD,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EAtD6G,CAmE7G;;AACAD,IAAAA,MAAM,CAACG,UAAD,CAAN,CAAmBF,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EApE6G,CAiF7G;;AACAD,IAAAA,MAAM,CAACI,UAAD,CAAN,CAAmBH,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EAlF6G,CA+F7G;;AACAD,IAAAA,MAAM,CAACK,UAAD,CAAN,CAAmBJ,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI;AAYD,GA5GC,CAAF;AA6GD,CA1KO,CAAR","sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { renderHook } from \"@testing-library/react-hooks\";\n\nimport { useVisibleRanges } from \"./useVisibleRanges\";\n\nconst viewSize = 393;\n\ndescribe(\"useVisibleRanges\", () => {\n it(\"should only display the front of the list when loop is false\", async () => {\n const hook = renderHook(() => {\n const translation = useSharedValue(-0);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n });\n\n const expected = hook.result.current.value;\n\n expect(expected).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -3,\n 0,\n ],\n \"positiveRange\": [\n 0,\n 3,\n ],\n }\n `);\n });\n\n it(\"should display the rear of the list and the front of the list when loop is true\", async () => {\n const hook = renderHook(() => {\n const translation = useSharedValue(-0);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: true,\n });\n\n return range;\n });\n\n const expected = hook.result.current.value;\n\n expect(expected).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n 8,\n 9,\n ],\n \"positiveRange\": [\n 0,\n 2,\n ],\n }\n `);\n });\n\n it(\"should shows the increased range of the list when the loop is false and swiped the carousel.\", async () => {\n const slide0hook = renderHook(() => {\n const translation = useSharedValue(-0 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide1hook = renderHook(() => {\n const translation = useSharedValue(-1 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide2hook = renderHook(() => {\n const translation = useSharedValue(-2 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide3hook = renderHook(() => {\n const translation = useSharedValue(-3 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n // [0,3] Display the 0,1,2,3 items.\n expect(slide0hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -3,\n 0,\n ],\n \"positiveRange\": [\n 0,\n 3,\n ],\n }\n `);\n\n // [1,4] Display the 1,2,3,4 items.\n expect(slide1hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -2,\n 1,\n ],\n \"positiveRange\": [\n 1,\n 4,\n ],\n }\n `);\n\n // [2,5] Display the 2,3,4,5 items.\n expect(slide2hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -1,\n 2,\n ],\n \"positiveRange\": [\n 2,\n 5,\n ],\n }\n `);\n\n // [3.6] Display the 3,4,5,6 items.\n expect(slide3hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n 0,\n 3,\n ],\n \"positiveRange\": [\n 3,\n 6,\n ],\n }\n `);\n });\n});\n"]}
1
+ {"version":3,"sources":["useVisibleRanges.test.tsx"],"names":["viewSize","describe","it","hook","translation","range","total","windowSize","loop","expected","result","current","value","expect","toMatchInlineSnapshot","slide0hook","slide1hook","slide2hook","slide3hook"],"mappings":"qLAAA,8DAEA,wDAEA,oDAEA,GAAMA,CAAAA,QAAQ,CAAG,GAAjB,CAEAC,QAAQ,CAAC,kBAAD,CAAqB,UAAM,CACjCC,EAAE,CAAC,8DAAD,gCAAiE,WAAY,CAC7E,GAAMC,CAAAA,IAAI,CAAG,2BAAW,UAAM,CAC5B,GAAMC,CAAAA,WAAW,CAAG,0CAAe,CAAC,CAAhB,CAApB,CACA,GAAMC,CAAAA,KAAK,CAAG,uCAAiB,CAC7BC,KAAK,CAAE,EADsB,CAE7BF,WAAW,CAAXA,WAF6B,CAG7BJ,QAAQ,CAARA,QAH6B,CAI7BO,UAAU,CAAE,CAJiB,CAK7BC,IAAI,CAAE,KALuB,CAAjB,CAAd,CAQA,MAAOH,CAAAA,KAAP,CACD,CAXY,CAAb,CAaA,GAAMI,CAAAA,QAAQ,CAAGN,IAAI,CAACO,MAAL,CAAYC,OAAZ,CAAoBC,KAArC,CAEAC,MAAM,CAACJ,QAAD,CAAN,CAAiBK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CAAmBF,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EAcAD,MAAM,CAACI,UAAD,CAAN,CAAmBH,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EAcAD,MAAM,CAACK,UAAD,CAAN,CAAmBJ,qBAAnB,CAA0C;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAXI,EAYD,CA5GC,EAAF,CA6GD,CA1KO,CAAR","sourcesContent":["import { useSharedValue } from \"react-native-reanimated\";\n\nimport { renderHook } from \"@testing-library/react-hooks\";\n\nimport { useVisibleRanges } from \"./useVisibleRanges\";\n\nconst viewSize = 393;\n\ndescribe(\"useVisibleRanges\", () => {\n it(\"should only display the front of the list when loop is false\", async () => {\n const hook = renderHook(() => {\n const translation = useSharedValue(-0);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n });\n\n const expected = hook.result.current.value;\n\n expect(expected).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -3,\n 0,\n ],\n \"positiveRange\": [\n 0,\n 3,\n ],\n }\n `);\n });\n\n it(\"should display the rear of the list and the front of the list when loop is true\", async () => {\n const hook = renderHook(() => {\n const translation = useSharedValue(-0);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: true,\n });\n\n return range;\n });\n\n const expected = hook.result.current.value;\n\n expect(expected).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n 8,\n 9,\n ],\n \"positiveRange\": [\n 0,\n 2,\n ],\n }\n `);\n });\n\n it(\"should shows the increased range of the list when the loop is false and swiped the carousel.\", async () => {\n const slide0hook = renderHook(() => {\n const translation = useSharedValue(-0 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide1hook = renderHook(() => {\n const translation = useSharedValue(-1 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide2hook = renderHook(() => {\n const translation = useSharedValue(-2 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n const slide3hook = renderHook(() => {\n const translation = useSharedValue(-3 * viewSize);\n const range = useVisibleRanges({\n total: 10,\n translation,\n viewSize,\n windowSize: 4,\n loop: false,\n });\n\n return range;\n }).result.current.value;\n\n // [0,3] Display the 0,1,2,3 items.\n expect(slide0hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -3,\n 0,\n ],\n \"positiveRange\": [\n 0,\n 3,\n ],\n }\n `);\n\n // [1,4] Display the 1,2,3,4 items.\n expect(slide1hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -2,\n 1,\n ],\n \"positiveRange\": [\n 1,\n 4,\n ],\n }\n `);\n\n // [2,5] Display the 2,3,4,5 items.\n expect(slide2hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n -1,\n 2,\n ],\n \"positiveRange\": [\n 2,\n 5,\n ],\n }\n `);\n\n // [3.6] Display the 3,4,5,6 items.\n expect(slide3hook).toMatchInlineSnapshot(`\n {\n \"negativeRange\": [\n 0,\n 3,\n ],\n \"positiveRange\": [\n 3,\n 6,\n ],\n }\n `);\n });\n});\n"]}
@@ -1,22 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Pagination", {
7
- enumerable: true,
8
- get: function () {
9
- return _Pagination.Pagination;
10
- }
11
- });
12
- exports.default = void 0;
13
-
14
- var _Carousel = _interopRequireDefault(require("./components/Carousel"));
15
-
16
- var _Pagination = require("./components/Pagination");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var _default = _Carousel.default;
21
- exports.default = _default;
1
+ var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"Pagination",{enumerable:true,get:function get(){return _Pagination.Pagination;}});exports.default=void 0;var _Carousel=_interopRequireDefault(require("./components/Carousel"));var _Pagination=require("./components/Pagination");var _default=_Carousel.default;exports.default=_default;
22
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["Carousel"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;eAWeA,iB","sourcesContent":["import Carousel from \"./components/Carousel\";\nexport { Pagination } from \"./components/Pagination\";\n\nexport type {\n TCarouselProps,\n ICarouselInstance,\n IComputedDirectionTypes,\n CarouselRenderItem,\n} from \"./types\";\nexport type { TAnimationStyle } from \"./components/ItemLayout\";\nexport type { ILayoutConfig } from \"./layouts/stack\";\n\nexport default Carousel;\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["Carousel"],"mappings":"oRAAA,uEACA,mD,aAWeA,iB","sourcesContent":["import Carousel from \"./components/Carousel\";\nexport { Pagination } from \"./components/Pagination\";\n\nexport type {\n TCarouselProps,\n ICarouselInstance,\n IComputedDirectionTypes,\n CarouselRenderItem,\n} from \"./types\";\nexport type { TAnimationStyle } from \"./components/ItemLayout\";\nexport type { ILayoutConfig } from \"./layouts/stack\";\n\nexport default Carousel;\n"]}
@@ -1,21 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Layouts = void 0;
7
-
8
- var _normal = require("./normal");
9
-
10
- var _parallax = require("./parallax");
11
-
12
- var _stack = require("./stack");
13
-
14
- const Layouts = {
15
- normal: _normal.normalLayout,
16
- parallax: _parallax.parallaxLayout,
17
- horizontalStack: _stack.horizontalStackLayout,
18
- verticalStack: _stack.verticalStackLayout
19
- };
20
- exports.Layouts = Layouts;
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.Layouts=void 0;var _normal=require("./normal");var _parallax=require("./parallax");var _stack=require("./stack");var Layouts={normal:_normal.normalLayout,parallax:_parallax.parallaxLayout,horizontalStack:_stack.horizontalStackLayout,verticalStack:_stack.verticalStackLayout};exports.Layouts=Layouts;
21
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["Layouts","normal","normalLayout","parallax","parallaxLayout","horizontalStack","horizontalStackLayout","verticalStack","verticalStackLayout"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAIO,MAAMA,OAAO,GAAG;AACrBC,EAAAA,MAAM,EAAEC,oBADa;AAErBC,EAAAA,QAAQ,EAAEC,wBAFW;AAGrBC,EAAAA,eAAe,EAAEC,4BAHI;AAIrBC,EAAAA,aAAa,EAAEC;AAJM,CAAhB","sourcesContent":["import { normalLayout } from \"./normal\";\nimport { parallaxLayout } from \"./parallax\";\nimport { horizontalStackLayout, verticalStackLayout } from \"./stack\";\n\nexport type TMode = \"parallax\" | \"horizontal-stack\" | \"vertical-stack\";\n\nexport const Layouts = {\n normal: normalLayout,\n parallax: parallaxLayout,\n horizontalStack: horizontalStackLayout,\n verticalStack: verticalStackLayout,\n};\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["Layouts","normal","normalLayout","parallax","parallaxLayout","horizontalStack","horizontalStackLayout","verticalStack","verticalStackLayout"],"mappings":"gFAAA,gCACA,oCACA,8BAIO,GAAMA,CAAAA,OAAO,CAAG,CACrBC,MAAM,CAAEC,oBADa,CAErBC,QAAQ,CAAEC,wBAFW,CAGrBC,eAAe,CAAEC,4BAHI,CAIrBC,aAAa,CAAEC,0BAJM,CAAhB,C","sourcesContent":["import { normalLayout } from \"./normal\";\nimport { parallaxLayout } from \"./parallax\";\nimport { horizontalStackLayout, verticalStackLayout } from \"./stack\";\n\nexport type TMode = \"parallax\" | \"horizontal-stack\" | \"vertical-stack\";\n\nexport const Layouts = {\n normal: normalLayout,\n parallax: parallaxLayout,\n horizontalStack: horizontalStackLayout,\n verticalStack: verticalStackLayout,\n};\n"]}
@@ -1,28 +1,2 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.normalLayout = normalLayout;
7
-
8
- var _reactNativeReanimated = require("react-native-reanimated");
9
-
10
- function normalLayout(opts) {
11
- const {
12
- size,
13
- vertical
14
- } = opts;
15
- return value => {
16
- "worklet";
17
-
18
- const translate = (0, _reactNativeReanimated.interpolate)(value, [-1, 0, 1], [-size, 0, size]);
19
- return {
20
- transform: [vertical ? {
21
- translateY: translate
22
- } : {
23
- translateX: translate
24
- }]
25
- };
26
- };
27
- }
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.normalLayout=normalLayout;var _reactNativeReanimated=require("react-native-reanimated");var _worklet_11131623104943_init_data={code:"function anonymous(value){const{interpolate,size,vertical}=this.__closure;const translate=interpolate(value,[-1,0,1],[-size,0,size]);return{transform:[vertical?{translateY:translate}:{translateX:translate}]};}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/normal.ts",sourceMap:"{\"version\":3,\"mappings\":\"AAKS,QAACA,UAAD,CAAmBA,KAAnB,CAAmB,iDAExB,KAAMC,UAAS,CAAGC,WAAW,CAACF,KAAD,CAAQ,CAAC,CAAC,CAAF,CAAK,CAAL,CAAQ,CAAR,CAAR,CAAoB,CAAC,CAACG,IAAF,CAAQ,CAAR,CAAWA,IAAX,CAApB,CAA7B,CAEA,MAAO,CACLC,SAAS,CAAE,CACTC,QAAQ,CACJ,CACEC,UAAU,CAAEL,SADd,CADI,CAIJ,CACEM,UAAU,CAAEN,SADd,CALK,CADN,CAAP,CAJK\",\"names\":[\"value\",\"translate\",\"interpolate\",\"size\",\"transform\",\"vertical\",\"translateY\",\"translateX\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/normal.ts\"]}",version:"3.10.1"};function normalLayout(opts){var size=opts.size,vertical=opts.vertical;return function(){var _e=[new global.Error(),-4,-27];var anonymous=function anonymous(value){var translate=(0,_reactNativeReanimated.interpolate)(value,[-1,0,1],[-size,0,size]);return{transform:[vertical?{translateY:translate}:{translateX:translate}]};};anonymous.__closure={interpolate:_reactNativeReanimated.interpolate,size:size,vertical:vertical};anonymous.__workletHash=11131623104943;anonymous.__initData=_worklet_11131623104943_init_data;anonymous.__stackDetails=_e;return anonymous;}();}
28
2
  //# sourceMappingURL=normal.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["normal.ts"],"names":["normalLayout","opts","size","vertical","value","translate","transform","translateY","translateX"],"mappings":";;;;;;;AAAA;;AAEO,SAASA,YAAT,CAAsBC,IAAtB,EAAiE;AACtE,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAqBF,IAA3B;AAEA,SAAQG,KAAD,IAAmB;AACxB;;AACA,UAAMC,SAAS,GAAG,wCAAYD,KAAZ,EAAmB,CAAC,CAAC,CAAF,EAAK,CAAL,EAAQ,CAAR,CAAnB,EAA+B,CAAC,CAACF,IAAF,EAAQ,CAAR,EAAWA,IAAX,CAA/B,CAAlB;AAEA,WAAO;AACLI,MAAAA,SAAS,EAAE,CACTH,QAAQ,GACJ;AACEI,QAAAA,UAAU,EAAEF;AADd,OADI,GAIJ;AACEG,QAAAA,UAAU,EAAEH;AADd,OALK;AADN,KAAP;AAWD,GAfD;AAgBD","sourcesContent":["import { interpolate } from \"react-native-reanimated\";\n\nexport function normalLayout(opts: { size: number; vertical: boolean }) {\n const { size, vertical } = opts;\n\n return (value: number) => {\n \"worklet\";\n const translate = interpolate(value, [-1, 0, 1], [-size, 0, size]);\n\n return {\n transform: [\n vertical\n ? {\n translateY: translate,\n }\n : {\n translateX: translate,\n },\n ],\n };\n };\n}\n"]}
1
+ {"version":3,"sources":["normal.ts"],"names":["normalLayout","opts","size","vertical","value","translate","transform","translateY","translateX","interpolate"],"mappings":"2FAAA,8D,y8BAEO,QAASA,CAAAA,YAAT,CAAsBC,IAAtB,CAAiE,CACtE,GAAQC,CAAAA,IAAR,CAA2BD,IAA3B,CAAQC,IAAR,CAAcC,QAAd,CAA2BF,IAA3B,CAAcE,QAAd,CAEA,MAAO,gFAACC,KAAD,CAAmB,CAExB,GAAMC,CAAAA,SAAS,CAAG,uCAAYD,KAAZ,CAAmB,CAAC,CAAC,CAAF,CAAK,CAAL,CAAQ,CAAR,CAAnB,CAA+B,CAAC,CAACF,IAAF,CAAQ,CAAR,CAAWA,IAAX,CAA/B,CAAlB,CAEA,MAAO,CACLI,SAAS,CAAE,CACTH,QAAQ,CACJ,CACEI,UAAU,CAAEF,SADd,CADI,CAIJ,CACEG,UAAU,CAAEH,SADd,CALK,CADN,CAAP,CAWD,CAfM,kCAEaI,kCAFb,MAE8CP,IAF9C,UAMDC,QANC,8IAAP,GAgBD","sourcesContent":["import { interpolate } from \"react-native-reanimated\";\n\nexport function normalLayout(opts: { size: number; vertical: boolean }) {\n const { size, vertical } = opts;\n\n return (value: number) => {\n \"worklet\";\n const translate = interpolate(value, [-1, 0, 1], [-size, 0, size]);\n\n return {\n transform: [\n vertical\n ? {\n translateY: translate,\n }\n : {\n translateX: translate,\n },\n ],\n };\n };\n}\n"]}