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

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 (143) hide show
  1. package/README.md +21 -160
  2. package/lib/commonjs/components/Carousel.js +231 -0
  3. package/lib/commonjs/components/Carousel.js.map +1 -0
  4. package/lib/commonjs/components/LazyView.js +22 -0
  5. package/lib/commonjs/components/LazyView.js.map +1 -0
  6. package/lib/commonjs/components/ScrollViewGesture.js +297 -0
  7. package/lib/commonjs/components/ScrollViewGesture.js.map +1 -0
  8. package/lib/commonjs/constants/index.js +21 -1
  9. package/lib/commonjs/constants/index.js.map +1 -1
  10. package/lib/commonjs/hooks/useAutoPlay.js +56 -1
  11. package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
  12. package/lib/commonjs/hooks/useCarouselController.js +244 -1
  13. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  14. package/lib/commonjs/hooks/useCheckMounted.js +23 -1
  15. package/lib/commonjs/hooks/useCheckMounted.js.map +1 -1
  16. package/lib/commonjs/hooks/useCommonVariables.js +76 -1
  17. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
  18. package/lib/commonjs/hooks/useInitProps.js +78 -1
  19. package/lib/commonjs/hooks/useInitProps.js.map +1 -1
  20. package/lib/commonjs/hooks/useLayoutConfig.js +39 -1
  21. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  22. package/lib/commonjs/hooks/useOffsetX.js +48 -1
  23. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  24. package/lib/commonjs/hooks/useOnProgressChange.js +38 -1
  25. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  26. package/lib/commonjs/hooks/usePropsErrorBoundary.js +36 -1
  27. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  28. package/lib/commonjs/hooks/useUpdateGestureConfig.js +20 -0
  29. package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -0
  30. package/lib/commonjs/hooks/useVisibleRanges.js +42 -1
  31. package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
  32. package/lib/commonjs/index.js +13 -1
  33. package/lib/commonjs/index.js.map +1 -1
  34. package/lib/commonjs/layouts/BaseLayout.js +110 -1
  35. package/lib/commonjs/layouts/BaseLayout.js.map +1 -1
  36. package/lib/commonjs/layouts/ParallaxLayout.js +83 -1
  37. package/lib/commonjs/layouts/ParallaxLayout.js.map +1 -1
  38. package/lib/commonjs/layouts/index.js +20 -1
  39. package/lib/commonjs/layouts/index.js.map +1 -1
  40. package/lib/commonjs/layouts/normal.js +27 -1
  41. package/lib/commonjs/layouts/normal.js.map +1 -1
  42. package/lib/commonjs/layouts/parallax.js +38 -1
  43. package/lib/commonjs/layouts/parallax.js.map +1 -1
  44. package/lib/commonjs/layouts/stack.js +215 -1
  45. package/lib/commonjs/layouts/stack.js.map +1 -1
  46. package/lib/commonjs/store/index.js +14 -1
  47. package/lib/commonjs/store/index.js.map +1 -1
  48. package/lib/commonjs/types.js +5 -1
  49. package/lib/commonjs/utils/computeNewIndexWhenDataChanges.js +52 -0
  50. package/lib/commonjs/utils/computeNewIndexWhenDataChanges.js.map +1 -0
  51. package/lib/commonjs/utils/computed-with-auto-fill-data.js +124 -0
  52. package/lib/commonjs/utils/computed-with-auto-fill-data.js.map +1 -0
  53. package/lib/commonjs/utils/deal-with-animation.js +21 -0
  54. package/lib/commonjs/utils/deal-with-animation.js.map +1 -0
  55. package/lib/commonjs/utils/handleroffset-direction.js +16 -0
  56. package/lib/commonjs/utils/handleroffset-direction.js.map +1 -0
  57. package/lib/commonjs/utils/index.test.js +74 -0
  58. package/lib/commonjs/utils/index.test.js.map +1 -0
  59. package/lib/commonjs/utils/log.js +22 -1
  60. package/lib/commonjs/utils/log.js.map +1 -1
  61. package/lib/module/{Carousel.js → components/Carousel.js} +11 -12
  62. package/lib/module/components/Carousel.js.map +1 -0
  63. package/lib/module/{ScrollViewGesture.js → components/ScrollViewGesture.js} +14 -6
  64. package/lib/module/components/ScrollViewGesture.js.map +1 -0
  65. package/lib/module/hooks/useCarouselController.js +3 -3
  66. package/lib/module/hooks/useCarouselController.js.map +1 -1
  67. package/lib/module/hooks/useCommonVariables.js +2 -2
  68. package/lib/module/hooks/useCommonVariables.js.map +1 -1
  69. package/lib/module/hooks/useInitProps.js +1 -3
  70. package/lib/module/hooks/useInitProps.js.map +1 -1
  71. package/lib/module/hooks/useOnProgressChange.js +1 -1
  72. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  73. package/lib/module/hooks/useUpdateGestureConfig.js +10 -0
  74. package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -0
  75. package/lib/module/index.js +1 -2
  76. package/lib/module/index.js.map +1 -1
  77. package/lib/module/layouts/BaseLayout.js +1 -1
  78. package/lib/module/layouts/BaseLayout.js.map +1 -1
  79. package/lib/module/layouts/ParallaxLayout.js +1 -1
  80. package/lib/module/layouts/ParallaxLayout.js.map +1 -1
  81. package/lib/module/utils/{computedWithAutoFillData.js → computed-with-auto-fill-data.js} +1 -1
  82. package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -0
  83. package/lib/module/utils/{dealWithAnimation.js → deal-with-animation.js} +1 -1
  84. package/lib/module/utils/deal-with-animation.js.map +1 -0
  85. package/lib/module/utils/{handlerOffsetDirection.js → handleroffset-direction.js} +1 -1
  86. package/lib/module/utils/handleroffset-direction.js.map +1 -0
  87. package/lib/typescript/{Carousel.d.ts → components/Carousel.d.ts} +1 -1
  88. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +4 -0
  89. package/lib/typescript/index.d.ts +2 -2
  90. package/lib/typescript/types.d.ts +103 -103
  91. package/package.json +18 -16
  92. package/src/{Carousel.tsx → components/Carousel.tsx} +13 -13
  93. package/src/{ScrollViewGesture.tsx → components/ScrollViewGesture.tsx} +30 -15
  94. package/src/hooks/useCarouselController.tsx +3 -3
  95. package/src/hooks/useCommonVariables.ts +2 -2
  96. package/src/hooks/useInitProps.ts +1 -3
  97. package/src/hooks/useOnProgressChange.ts +1 -1
  98. package/src/hooks/useUpdateGestureConfig.ts +13 -0
  99. package/src/index.tsx +2 -2
  100. package/src/layouts/BaseLayout.tsx +1 -1
  101. package/src/layouts/ParallaxLayout.tsx +1 -1
  102. package/src/types.ts +122 -124
  103. package/README.zh-CN.md +0 -202
  104. package/lib/commonjs/Carousel.js +0 -2
  105. package/lib/commonjs/Carousel.js.map +0 -1
  106. package/lib/commonjs/LazyView.js +0 -2
  107. package/lib/commonjs/LazyView.js.map +0 -1
  108. package/lib/commonjs/ScrollViewGesture.js +0 -2
  109. package/lib/commonjs/ScrollViewGesture.js.map +0 -1
  110. package/lib/commonjs/hooks/computeNewIndexWhenDataChanges.js +0 -2
  111. package/lib/commonjs/hooks/computeNewIndexWhenDataChanges.js.map +0 -1
  112. package/lib/commonjs/hooks/index.test.js +0 -2
  113. package/lib/commonjs/hooks/index.test.js.map +0 -1
  114. package/lib/commonjs/utils/computedWithAutoFillData.js +0 -2
  115. package/lib/commonjs/utils/computedWithAutoFillData.js.map +0 -1
  116. package/lib/commonjs/utils/dealWithAnimation.js +0 -2
  117. package/lib/commonjs/utils/dealWithAnimation.js.map +0 -1
  118. package/lib/commonjs/utils/handlerOffsetDirection.js +0 -2
  119. package/lib/commonjs/utils/handlerOffsetDirection.js.map +0 -1
  120. package/lib/module/Carousel.js.map +0 -1
  121. package/lib/module/ScrollViewGesture.js.map +0 -1
  122. package/lib/module/utils/computedWithAutoFillData.js.map +0 -1
  123. package/lib/module/utils/dealWithAnimation.js.map +0 -1
  124. package/lib/module/utils/handlerOffsetDirection.js.map +0 -1
  125. /package/lib/module/{LazyView.js → components/LazyView.js} +0 -0
  126. /package/lib/module/{LazyView.js.map → components/LazyView.js.map} +0 -0
  127. /package/lib/module/{hooks → utils}/computeNewIndexWhenDataChanges.js +0 -0
  128. /package/lib/module/{hooks → utils}/computeNewIndexWhenDataChanges.js.map +0 -0
  129. /package/lib/module/{hooks → utils}/index.test.js +0 -0
  130. /package/lib/module/{hooks → utils}/index.test.js.map +0 -0
  131. /package/lib/typescript/{LazyView.d.ts → components/LazyView.d.ts} +0 -0
  132. /package/lib/typescript/{ScrollViewGesture.d.ts → components/ScrollViewGesture.d.ts} +0 -0
  133. /package/lib/typescript/{hooks → utils}/computeNewIndexWhenDataChanges.d.ts +0 -0
  134. /package/lib/typescript/utils/{computedWithAutoFillData.d.ts → computed-with-auto-fill-data.d.ts} +0 -0
  135. /package/lib/typescript/utils/{dealWithAnimation.d.ts → deal-with-animation.d.ts} +0 -0
  136. /package/lib/typescript/utils/{handlerOffsetDirection.d.ts → handleroffset-direction.d.ts} +0 -0
  137. /package/lib/typescript/{hooks → utils}/index.test.d.ts +0 -0
  138. /package/src/{LazyView.tsx → components/LazyView.tsx} +0 -0
  139. /package/src/{hooks → utils}/computeNewIndexWhenDataChanges.ts +0 -0
  140. /package/src/utils/{computedWithAutoFillData.ts → computed-with-auto-fill-data.ts} +0 -0
  141. /package/src/utils/{dealWithAnimation.ts → deal-with-animation.ts} +0 -0
  142. /package/src/utils/{handlerOffsetDirection.ts → handleroffset-direction.ts} +0 -0
  143. /package/src/{hooks → utils}/index.test.ts +0 -0
@@ -1,2 +1,40 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useLayoutConfig=useLayoutConfig;var _react=_interopRequireDefault(require("react"));var _layouts=require("../layouts");function useLayoutConfig(opts){var _ref=opts,size=_ref.size,vertical=_ref.vertical;return _react.default.useMemo(function(){var baseConfig={size:size,vertical:vertical};switch(opts.mode){case"parallax":return _layouts.Layouts.parallax(baseConfig,opts.modeConfig);case"horizontal-stack":return _layouts.Layouts.horizontalStack(opts.modeConfig);case"vertical-stack":return _layouts.Layouts.verticalStack(opts.modeConfig);default:return _layouts.Layouts.normal(baseConfig);}},[opts.mode,opts.modeConfig,size,vertical]);}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useLayoutConfig = useLayoutConfig;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _layouts = require("../layouts");
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function useLayoutConfig(opts) {
15
+ const {
16
+ size,
17
+ vertical
18
+ } = opts;
19
+ return _react.default.useMemo(() => {
20
+ const baseConfig = {
21
+ size,
22
+ vertical
23
+ };
24
+
25
+ switch (opts.mode) {
26
+ case "parallax":
27
+ return _layouts.Layouts.parallax(baseConfig, opts.modeConfig);
28
+
29
+ case "horizontal-stack":
30
+ return _layouts.Layouts.horizontalStack(opts.modeConfig);
31
+
32
+ case "vertical-stack":
33
+ return _layouts.Layouts.verticalStack(opts.modeConfig);
34
+
35
+ default:
36
+ return _layouts.Layouts.normal(baseConfig);
37
+ }
38
+ }, [opts.mode, opts.modeConfig, size, vertical]);
39
+ }
2
40
  //# sourceMappingURL=useLayoutConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useLayoutConfig.ts"],"names":["useLayoutConfig","opts","size","vertical","React","useMemo","baseConfig","mode","Layouts","parallax","modeConfig","horizontalStack","verticalStack","normal"],"mappings":"oLAAA,oDAIA,mCAKO,QAASA,CAAAA,eAAT,CACLC,IADK,CAEY,CACjB,SAA2BA,IAA3B,CAAQC,IAAR,MAAQA,IAAR,CAAcC,QAAd,MAAcA,QAAd,CAEA,MAAOC,gBAAMC,OAAN,CAAc,UAAM,CACzB,GAAMC,CAAAA,UAAU,CAAG,CAAEJ,IAAI,CAAJA,IAAF,CAAQC,QAAQ,CAARA,QAAR,CAAnB,CACA,OAAQF,IAAI,CAACM,IAAb,EACE,IAAK,UAAL,CACE,MAAOC,kBAAQC,QAAR,CAAiBH,UAAjB,CAA6BL,IAAI,CAACS,UAAlC,CAAP,CACF,IAAK,kBAAL,CACE,MAAOF,kBAAQG,eAAR,CAAwBV,IAAI,CAACS,UAA7B,CAAP,CACF,IAAK,gBAAL,CACE,MAAOF,kBAAQI,aAAR,CAAsBX,IAAI,CAACS,UAA3B,CAAP,CACF,QACE,MAAOF,kBAAQK,MAAR,CAAeP,UAAf,CAAP,CARJ,CAUD,CAZM,CAYJ,CAACL,IAAI,CAACM,IAAN,CAAYN,IAAI,CAACS,UAAjB,CAA6BR,IAA7B,CAAmCC,QAAnC,CAZI,CAAP,CAaD","sourcesContent":["import React from \"react\";\n\nimport type { TInitializeCarouselProps } from \"./useInitProps\";\n\nimport { Layouts } from \"../layouts\";\nimport type { TAnimationStyle } from \"../layouts/BaseLayout\";\n\ntype TLayoutConfigOpts<T> = TInitializeCarouselProps<T> & { size: number };\n\nexport function useLayoutConfig<T>(\n opts: TLayoutConfigOpts<T>,\n): TAnimationStyle {\n const { size, vertical } = opts as Required<TLayoutConfigOpts<T>>;\n\n return React.useMemo(() => {\n const baseConfig = { size, vertical };\n switch (opts.mode) {\n case \"parallax\":\n return Layouts.parallax(baseConfig, opts.modeConfig);\n case \"horizontal-stack\":\n return Layouts.horizontalStack(opts.modeConfig);\n case \"vertical-stack\":\n return Layouts.verticalStack(opts.modeConfig);\n default:\n return Layouts.normal(baseConfig);\n }\n }, [opts.mode, opts.modeConfig, size, vertical]);\n}\n"]}
1
+ {"version":3,"sources":["useLayoutConfig.ts"],"names":["useLayoutConfig","opts","size","vertical","React","useMemo","baseConfig","mode","Layouts","parallax","modeConfig","horizontalStack","verticalStack","normal"],"mappings":";;;;;;;AAAA;;AAIA;;;;AAKO,SAASA,eAAT,CACLC,IADK,EAEY;AACjB,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAqBF,IAA3B;AAEA,SAAOG,eAAMC,OAAN,CAAc,MAAM;AACzB,UAAMC,UAAU,GAAG;AAAEJ,MAAAA,IAAF;AAAQC,MAAAA;AAAR,KAAnB;;AACA,YAAQF,IAAI,CAACM,IAAb;AACE,WAAK,UAAL;AACE,eAAOC,iBAAQC,QAAR,CAAiBH,UAAjB,EAA6BL,IAAI,CAACS,UAAlC,CAAP;;AACF,WAAK,kBAAL;AACE,eAAOF,iBAAQG,eAAR,CAAwBV,IAAI,CAACS,UAA7B,CAAP;;AACF,WAAK,gBAAL;AACE,eAAOF,iBAAQI,aAAR,CAAsBX,IAAI,CAACS,UAA3B,CAAP;;AACF;AACE,eAAOF,iBAAQK,MAAR,CAAeP,UAAf,CAAP;AARJ;AAUD,GAZM,EAYJ,CAACL,IAAI,CAACM,IAAN,EAAYN,IAAI,CAACS,UAAjB,EAA6BR,IAA7B,EAAmCC,QAAnC,CAZI,CAAP;AAaD","sourcesContent":["import React from \"react\";\n\nimport type { TInitializeCarouselProps } from \"./useInitProps\";\n\nimport { Layouts } from \"../layouts\";\nimport type { TAnimationStyle } from \"../layouts/BaseLayout\";\n\ntype TLayoutConfigOpts<T> = TInitializeCarouselProps<T> & { size: number };\n\nexport function useLayoutConfig<T>(\n opts: TLayoutConfigOpts<T>,\n): TAnimationStyle {\n const { size, vertical } = opts as Required<TLayoutConfigOpts<T>>;\n\n return React.useMemo(() => {\n const baseConfig = { size, vertical };\n switch (opts.mode) {\n case \"parallax\":\n return Layouts.parallax(baseConfig, opts.modeConfig);\n case \"horizontal-stack\":\n return Layouts.horizontalStack(opts.modeConfig);\n case \"vertical-stack\":\n return Layouts.verticalStack(opts.modeConfig);\n default:\n return Layouts.normal(baseConfig);\n }\n }, [opts.mode, opts.modeConfig, size, vertical]);\n}\n"]}
@@ -1,2 +1,49 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.useOffsetX=void 0;var _reactNativeReanimated=require("react-native-reanimated");var _worklet_63816918029_init_data={code:"function anonymous() {\n const {\n visibleRanges,\n index,\n loop,\n TOTAL_WIDTH,\n MIN,\n HALF_WIDTH,\n startPos,\n MAX,\n interpolate,\n handlerOffset,\n Extrapolate,\n size\n } = this._closure;\n const {\n negativeRange: negativeRange,\n positiveRange: positiveRange\n } = visibleRanges.value;\n if ((index < negativeRange[0] || index > negativeRange[1]) && (index < positiveRange[0] || index > positiveRange[1])) return Number.MAX_SAFE_INTEGER;\n if (loop) {\n const inputRange = [-TOTAL_WIDTH, MIN - HALF_WIDTH - startPos - Number.MIN_VALUE, MIN - HALF_WIDTH - startPos, 0, MAX + HALF_WIDTH - startPos, MAX + HALF_WIDTH - startPos + Number.MIN_VALUE, TOTAL_WIDTH];\n const outputRange = [startPos, MAX + HALF_WIDTH - Number.MIN_VALUE, MIN - HALF_WIDTH, startPos, MAX + HALF_WIDTH, MIN - HALF_WIDTH + Number.MIN_VALUE, startPos];\n return interpolate(handlerOffset.value, inputRange, outputRange, Extrapolate.CLAMP);\n }\n return handlerOffset.value + size * index;\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOffsetX.ts",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"visibleRanges\",\"index\",\"loop\",\"TOTAL_WIDTH\",\"MIN\",\"HALF_WIDTH\",\"startPos\",\"MAX\",\"interpolate\",\"handlerOffset\",\"Extrapolate\",\"size\",\"_closure\",\"negativeRange\",\"positiveRange\",\"value\",\"Number\",\"MAX_SAFE_INTEGER\",\"inputRange\",\"MIN_VALUE\",\"outputRange\",\"CLAMP\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOffsetX.ts\"],\"mappings\":\"AA8C4B,SAAAA,SAAMA,CAAA;EAAA;IAAAC,aAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,WAAA;IAAAC,GAAA;IAAAC,UAAA;IAAAC,QAAA;IAAAC,GAAA;IAAAC,WAAA;IAAAC,aAAA;IAAAC,WAAA;IAAAC;EAAA,SAAAC,QAAA;EAC9B,MAAM;IAAEC,aAAa,EAAbA,aAAa;IAAEC,aAAA,EAAAA;EAAc,CAAC,GAAGd,aAAa,CAACe,KAAK;EAC5D,IACE,CAACd,KAAK,GAAGY,aAAa,CAAC,CAAC,CAAC,IAAIZ,KAAK,GAAGY,aAAa,CAAC,CAAC,CAAC,MAC3CZ,KAAK,GAAGa,aAAa,CAAC,CAAC,CAAC,IAAIb,KAAK,GAAGa,aAAa,CAAC,CAAC,CAAC,CAAC,EAE/D,OAAOE,MAAM,CAACC,gBAAgB;EAEhC,IAAIf,IAAI,EAAE;IACR,MAAMgB,UAAU,GAAG,CACjB,CAACf,WAAW,EACZC,GAAG,GAAGC,UAAU,GAAGC,QAAQ,GAAGU,MAAM,CAACG,SAAS,EAC9Cf,GAAG,GAAGC,UAAU,GAAGC,QAAQ,EAC3B,CAAC,EACDC,GAAG,GAAGF,UAAU,GAAGC,QAAQ,EAC3BC,GAAG,GAAGF,UAAU,GAAGC,QAAQ,GAAGU,MAAM,CAACG,SAAS,EAC9ChB,WAAW,CACZ;IAED,MAAMiB,WAAW,GAAG,CAClBd,QAAQ,EACRC,GAAG,GAAGF,UAAU,GAAGW,MAAM,CAACG,SAAS,EACnCf,GAAG,GAAGC,UAAU,EAChBC,QAAQ,EACRC,GAAG,GAAGF,UAAU,EAChBD,GAAG,GAAGC,UAAU,GAAGW,MAAM,CAACG,SAAS,EACnCb,QAAQ,CACT;IAED,OAAOE,WAAW,CAChBC,aAAa,CAACM,KAAK,EACnBG,UAAU,EACVE,WAAW,EACXV,WAAW,CAACW,KACd,CAAC;EACH;EAEA,OAAOZ,aAAa,CAACM,KAAK,GAAGJ,IAAI,GAAGV,KAAK;AAC3C\"}"};var useOffsetX=function useOffsetX(opts,visibleRanges){var handlerOffset=opts.handlerOffset,index=opts.index,size=opts.size,loop=opts.loop,dataLength=opts.dataLength,_opts$type=opts.type,type=_opts$type===void 0?"positive":_opts$type,_viewCount=opts.viewCount;var ITEM_LENGTH=dataLength;var VALID_LENGTH=ITEM_LENGTH-1;var TOTAL_WIDTH=size*ITEM_LENGTH;var HALF_WIDTH=0.5*size;var viewCount=_viewCount!=null?_viewCount:Math.round((ITEM_LENGTH-1)/2);var positiveCount=type==="positive"?viewCount:VALID_LENGTH-viewCount;var startPos=size*index;if(index>positiveCount)startPos=(index-ITEM_LENGTH)*size;var MAX=positiveCount*size;var MIN=-((VALID_LENGTH-positiveCount)*size);var x=(0,_reactNativeReanimated.useDerivedValue)(function(){var _e=[new global.Error(),-13,-27];var _f=function _f(){var _visibleRanges$value=visibleRanges.value,negativeRange=_visibleRanges$value.negativeRange,positiveRange=_visibleRanges$value.positiveRange;if((index<negativeRange[0]||index>negativeRange[1])&&(index<positiveRange[0]||index>positiveRange[1]))return Number.MAX_SAFE_INTEGER;if(loop){var inputRange=[-TOTAL_WIDTH,MIN-HALF_WIDTH-startPos-Number.MIN_VALUE,MIN-HALF_WIDTH-startPos,0,MAX+HALF_WIDTH-startPos,MAX+HALF_WIDTH-startPos+Number.MIN_VALUE,TOTAL_WIDTH];var outputRange=[startPos,MAX+HALF_WIDTH-Number.MIN_VALUE,MIN-HALF_WIDTH,startPos,MAX+HALF_WIDTH,MIN-HALF_WIDTH+Number.MIN_VALUE,startPos];return(0,_reactNativeReanimated.interpolate)(handlerOffset.value,inputRange,outputRange,_reactNativeReanimated.Extrapolate.CLAMP);}return handlerOffset.value+size*index;};_f._closure={visibleRanges:visibleRanges,index:index,loop:loop,TOTAL_WIDTH:TOTAL_WIDTH,MIN:MIN,HALF_WIDTH:HALF_WIDTH,startPos:startPos,MAX:MAX,interpolate:_reactNativeReanimated.interpolate,handlerOffset:handlerOffset,Extrapolate:_reactNativeReanimated.Extrapolate,size:size};_f.__initData=_worklet_63816918029_init_data;_f.__workletHash=63816918029;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[loop,dataLength,viewCount,type,size,visibleRanges]);return x;};exports.useOffsetX=useOffsetX;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useOffsetX = void 0;
7
+
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+
10
+ const useOffsetX = (opts, visibleRanges) => {
11
+ const {
12
+ handlerOffset,
13
+ index,
14
+ size,
15
+ loop,
16
+ dataLength,
17
+ type = "positive",
18
+ viewCount: _viewCount
19
+ } = opts;
20
+ const ITEM_LENGTH = dataLength;
21
+ const VALID_LENGTH = ITEM_LENGTH - 1;
22
+ const TOTAL_WIDTH = size * ITEM_LENGTH;
23
+ const HALF_WIDTH = 0.5 * size;
24
+ const viewCount = _viewCount !== null && _viewCount !== void 0 ? _viewCount : Math.round((ITEM_LENGTH - 1) / 2);
25
+ const positiveCount = type === "positive" ? viewCount : VALID_LENGTH - viewCount;
26
+ let startPos = size * index;
27
+ if (index > positiveCount) startPos = (index - ITEM_LENGTH) * size;
28
+ const MAX = positiveCount * size;
29
+ const MIN = -((VALID_LENGTH - positiveCount) * size);
30
+ const x = (0, _reactNativeReanimated.useDerivedValue)(() => {
31
+ const {
32
+ negativeRange,
33
+ positiveRange
34
+ } = visibleRanges.value;
35
+ if ((index < negativeRange[0] || index > negativeRange[1]) && (index < positiveRange[0] || index > positiveRange[1])) return Number.MAX_SAFE_INTEGER;
36
+
37
+ if (loop) {
38
+ const inputRange = [-TOTAL_WIDTH, MIN - HALF_WIDTH - startPos - Number.MIN_VALUE, MIN - HALF_WIDTH - startPos, 0, MAX + HALF_WIDTH - startPos, MAX + HALF_WIDTH - startPos + Number.MIN_VALUE, TOTAL_WIDTH];
39
+ const outputRange = [startPos, MAX + HALF_WIDTH - Number.MIN_VALUE, MIN - HALF_WIDTH, startPos, MAX + HALF_WIDTH, MIN - HALF_WIDTH + Number.MIN_VALUE, startPos];
40
+ return (0, _reactNativeReanimated.interpolate)(handlerOffset.value, inputRange, outputRange, _reactNativeReanimated.Extrapolate.CLAMP);
41
+ }
42
+
43
+ return handlerOffset.value + size * index;
44
+ }, [loop, dataLength, viewCount, type, size, visibleRanges]);
45
+ return x;
46
+ };
47
+
48
+ exports.useOffsetX = useOffsetX;
2
49
  //# sourceMappingURL=useOffsetX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useOffsetX.ts"],"names":["useOffsetX","opts","visibleRanges","handlerOffset","index","size","loop","dataLength","type","_viewCount","viewCount","ITEM_LENGTH","VALID_LENGTH","TOTAL_WIDTH","HALF_WIDTH","Math","round","positiveCount","startPos","MAX","MIN","x","value","negativeRange","positiveRange","Number","MAX_SAFE_INTEGER","inputRange","MIN_VALUE","outputRange","Extrapolate","CLAMP","interpolate"],"mappings":"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","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport {\n Extrapolate,\n interpolate,\n useDerivedValue,\n} from \"react-native-reanimated\";\n\nimport type { IVisibleRanges } from \"./useVisibleRanges\";\n\nexport interface IOpts {\n index: number\n size: number\n handlerOffset: Animated.SharedValue<number>\n dataLength: number\n type?: \"positive\" | \"negative\"\n viewCount?: number\n loop?: boolean\n}\n\nexport const useOffsetX = (opts: IOpts, visibleRanges: IVisibleRanges) => {\n const {\n handlerOffset,\n index,\n size,\n loop,\n dataLength,\n type = \"positive\",\n viewCount: _viewCount,\n } = opts;\n\n const ITEM_LENGTH = dataLength;\n const VALID_LENGTH = ITEM_LENGTH - 1;\n const TOTAL_WIDTH = size * ITEM_LENGTH;\n const HALF_WIDTH = 0.5 * size;\n\n const viewCount = _viewCount ?? Math.round((ITEM_LENGTH - 1) / 2);\n const positiveCount\n = type === \"positive\" ? viewCount : VALID_LENGTH - viewCount;\n\n let startPos = size * index;\n if (index > positiveCount)\n startPos = (index - ITEM_LENGTH) * size;\n\n const MAX = positiveCount * size;\n const MIN = -((VALID_LENGTH - positiveCount) * size);\n\n const x = useDerivedValue(() => {\n const { negativeRange, positiveRange } = visibleRanges.value;\n if (\n (index < negativeRange[0] || index > negativeRange[1])\n && (index < positiveRange[0] || index > positiveRange[1])\n )\n return Number.MAX_SAFE_INTEGER;\n\n if (loop) {\n const inputRange = [\n -TOTAL_WIDTH,\n MIN - HALF_WIDTH - startPos - Number.MIN_VALUE,\n MIN - HALF_WIDTH - startPos,\n 0,\n MAX + HALF_WIDTH - startPos,\n MAX + HALF_WIDTH - startPos + Number.MIN_VALUE,\n TOTAL_WIDTH,\n ];\n\n const outputRange = [\n startPos,\n MAX + HALF_WIDTH - Number.MIN_VALUE,\n MIN - HALF_WIDTH,\n startPos,\n MAX + HALF_WIDTH,\n MIN - HALF_WIDTH + Number.MIN_VALUE,\n startPos,\n ];\n\n return interpolate(\n handlerOffset.value,\n inputRange,\n outputRange,\n Extrapolate.CLAMP,\n );\n }\n\n return handlerOffset.value + size * index;\n }, [loop, dataLength, viewCount, type, size, visibleRanges]);\n\n return x;\n};\n"]}
1
+ {"version":3,"sources":["useOffsetX.ts"],"names":["useOffsetX","opts","visibleRanges","handlerOffset","index","size","loop","dataLength","type","viewCount","_viewCount","ITEM_LENGTH","VALID_LENGTH","TOTAL_WIDTH","HALF_WIDTH","Math","round","positiveCount","startPos","MAX","MIN","x","negativeRange","positiveRange","value","Number","MAX_SAFE_INTEGER","inputRange","MIN_VALUE","outputRange","Extrapolate","CLAMP"],"mappings":";;;;;;;AACA;;AAkBO,MAAMA,UAAU,GAAG,CAACC,IAAD,EAAcC,aAAd,KAAgD;AACxE,QAAM;AACJC,IAAAA,aADI;AAEJC,IAAAA,KAFI;AAGJC,IAAAA,IAHI;AAIJC,IAAAA,IAJI;AAKJC,IAAAA,UALI;AAMJC,IAAAA,IAAI,GAAG,UANH;AAOJC,IAAAA,SAAS,EAAEC;AAPP,MAQFT,IARJ;AAUA,QAAMU,WAAW,GAAGJ,UAApB;AACA,QAAMK,YAAY,GAAGD,WAAW,GAAG,CAAnC;AACA,QAAME,WAAW,GAAGR,IAAI,GAAGM,WAA3B;AACA,QAAMG,UAAU,GAAG,MAAMT,IAAzB;AAEA,QAAMI,SAAS,GAAGC,UAAH,aAAGA,UAAH,cAAGA,UAAH,GAAiBK,IAAI,CAACC,KAAL,CAAW,CAACL,WAAW,GAAG,CAAf,IAAoB,CAA/B,CAAhC;AACA,QAAMM,aAAa,GACXT,IAAI,KAAK,UAAT,GAAsBC,SAAtB,GAAkCG,YAAY,GAAGH,SADzD;AAGA,MAAIS,QAAQ,GAAGb,IAAI,GAAGD,KAAtB;AACA,MAAIA,KAAK,GAAGa,aAAZ,EACEC,QAAQ,GAAG,CAACd,KAAK,GAAGO,WAAT,IAAwBN,IAAnC;AAEF,QAAMc,GAAG,GAAGF,aAAa,GAAGZ,IAA5B;AACA,QAAMe,GAAG,GAAG,EAAE,CAACR,YAAY,GAAGK,aAAhB,IAAiCZ,IAAnC,CAAZ;AAEA,QAAMgB,CAAC,GAAG,4CAAgB,MAAM;AAC9B,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAmCrB,aAAa,CAACsB,KAAvD;AACA,QACE,CAACpB,KAAK,GAAGkB,aAAa,CAAC,CAAD,CAArB,IAA4BlB,KAAK,GAAGkB,aAAa,CAAC,CAAD,CAAlD,MACUlB,KAAK,GAAGmB,aAAa,CAAC,CAAD,CAArB,IAA4BnB,KAAK,GAAGmB,aAAa,CAAC,CAAD,CAD3D,CADF,EAIE,OAAOE,MAAM,CAACC,gBAAd;;AAEF,QAAIpB,IAAJ,EAAU;AACR,YAAMqB,UAAU,GAAG,CACjB,CAACd,WADgB,EAEjBO,GAAG,GAAGN,UAAN,GAAmBI,QAAnB,GAA8BO,MAAM,CAACG,SAFpB,EAGjBR,GAAG,GAAGN,UAAN,GAAmBI,QAHF,EAIjB,CAJiB,EAKjBC,GAAG,GAAGL,UAAN,GAAmBI,QALF,EAMjBC,GAAG,GAAGL,UAAN,GAAmBI,QAAnB,GAA8BO,MAAM,CAACG,SANpB,EAOjBf,WAPiB,CAAnB;AAUA,YAAMgB,WAAW,GAAG,CAClBX,QADkB,EAElBC,GAAG,GAAGL,UAAN,GAAmBW,MAAM,CAACG,SAFR,EAGlBR,GAAG,GAAGN,UAHY,EAIlBI,QAJkB,EAKlBC,GAAG,GAAGL,UALY,EAMlBM,GAAG,GAAGN,UAAN,GAAmBW,MAAM,CAACG,SANR,EAOlBV,QAPkB,CAApB;AAUA,aAAO,wCACLf,aAAa,CAACqB,KADT,EAELG,UAFK,EAGLE,WAHK,EAILC,mCAAYC,KAJP,CAAP;AAMD;;AAED,WAAO5B,aAAa,CAACqB,KAAd,GAAsBnB,IAAI,GAAGD,KAApC;AACD,GAtCS,EAsCP,CAACE,IAAD,EAAOC,UAAP,EAAmBE,SAAnB,EAA8BD,IAA9B,EAAoCH,IAApC,EAA0CH,aAA1C,CAtCO,CAAV;AAwCA,SAAOmB,CAAP;AACD,CApEM","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport {\n Extrapolate,\n interpolate,\n useDerivedValue,\n} from \"react-native-reanimated\";\n\nimport type { IVisibleRanges } from \"./useVisibleRanges\";\n\nexport interface IOpts {\n index: number\n size: number\n handlerOffset: Animated.SharedValue<number>\n dataLength: number\n type?: \"positive\" | \"negative\"\n viewCount?: number\n loop?: boolean\n}\n\nexport const useOffsetX = (opts: IOpts, visibleRanges: IVisibleRanges) => {\n const {\n handlerOffset,\n index,\n size,\n loop,\n dataLength,\n type = \"positive\",\n viewCount: _viewCount,\n } = opts;\n\n const ITEM_LENGTH = dataLength;\n const VALID_LENGTH = ITEM_LENGTH - 1;\n const TOTAL_WIDTH = size * ITEM_LENGTH;\n const HALF_WIDTH = 0.5 * size;\n\n const viewCount = _viewCount ?? Math.round((ITEM_LENGTH - 1) / 2);\n const positiveCount\n = type === \"positive\" ? viewCount : VALID_LENGTH - viewCount;\n\n let startPos = size * index;\n if (index > positiveCount)\n startPos = (index - ITEM_LENGTH) * size;\n\n const MAX = positiveCount * size;\n const MIN = -((VALID_LENGTH - positiveCount) * size);\n\n const x = useDerivedValue(() => {\n const { negativeRange, positiveRange } = visibleRanges.value;\n if (\n (index < negativeRange[0] || index > negativeRange[1])\n && (index < positiveRange[0] || index > positiveRange[1])\n )\n return Number.MAX_SAFE_INTEGER;\n\n if (loop) {\n const inputRange = [\n -TOTAL_WIDTH,\n MIN - HALF_WIDTH - startPos - Number.MIN_VALUE,\n MIN - HALF_WIDTH - startPos,\n 0,\n MAX + HALF_WIDTH - startPos,\n MAX + HALF_WIDTH - startPos + Number.MIN_VALUE,\n TOTAL_WIDTH,\n ];\n\n const outputRange = [\n startPos,\n MAX + HALF_WIDTH - Number.MIN_VALUE,\n MIN - HALF_WIDTH,\n startPos,\n MAX + HALF_WIDTH,\n MIN - HALF_WIDTH + Number.MIN_VALUE,\n startPos,\n ];\n\n return interpolate(\n handlerOffset.value,\n inputRange,\n outputRange,\n Extrapolate.CLAMP,\n );\n }\n\n return handlerOffset.value + size * index;\n }, [loop, dataLength, viewCount, type, size, visibleRanges]);\n\n return x;\n};\n"]}
@@ -1,2 +1,39 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.useOnProgressChange=useOnProgressChange;var _reactNativeReanimated=require("react-native-reanimated");var _computedWithAutoFillData=require("../utils/computedWithAutoFillData");var _worklet_15415777011180_init_data={code:"function anonymous() {\n const {\n offsetX\n } = this._closure;\n return offsetX.value;\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOnProgressChange.ts",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"offsetX\",\"_closure\",\"value\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOnProgressChange.ts\"],\"mappings\":\"AAsBI,SAAAA,UAAA;EAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAMD,OAAQ,CAAAE,KAAA;AAAA\"}"};var _worklet_2512862808065_init_data={code:"function anonymous(_value) {\n const {\n computedOffsetXValueWithAutoFillData,\n rawDataLength,\n size,\n autoFillData,\n loop,\n onProgressChange,\n runOnJS\n } = this._closure;\n let value = computedOffsetXValueWithAutoFillData({\n value: _value,\n rawDataLength: rawDataLength,\n size: size,\n autoFillData: autoFillData,\n loop: loop\n });\n if (!loop) {\n value = Math.max(-((rawDataLength - 1) * size), Math.min(value, 0));\n }\n let absoluteProgress = Math.abs(value / size);\n if (value > 0) absoluteProgress = rawDataLength - absoluteProgress;\n if (onProgressChange) runOnJS(onProgressChange)(value, absoluteProgress);\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOnProgressChange.ts",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"_value\",\"computedOffsetXValueWithAutoFillData\",\"rawDataLength\",\"size\",\"autoFillData\",\"loop\",\"onProgressChange\",\"runOnJS\",\"_closure\",\"value\",\"Math\",\"max\",\"min\",\"absoluteProgress\",\"abs\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useOnProgressChange.ts\"],\"mappings\":\"AAuBK,SAAAA,SAAMA,CAAKC,MAAA;EAAA;IAAAC,oCAAA;IAAAC,aAAA;IAAAC,IAAA;IAAAC,YAAA;IAAAC,IAAA;IAAAC,gBAAA;IAAAC;EAAA,SAAAC,QAAA;EACV,IAAIC,KAAK,GAAGR,oCAAoC,CAAC;IAC/CQ,KAAK,EAAET,MAAM;IACbE,aAAa,EAAbA,aAAa;IACbC,IAAI,EAAJA,IAAI;IACJC,YAAY,EAAZA,YAAY;IACZC,IAAA,EAAAA;EACF,CAAC,CAAC;EAEF,IAAI,CAACA,IAAI,EAAE;IACTI,KAAK,GAAGC,IAAI,CAACC,GAAG,CACd,EAAE,CAACT,aAAa,GAAG,CAAC,IAAIC,IAAI,CAAC,EAC7BO,IAAI,CAACE,GAAG,CAACH,KAAK,EAAE,CAAC,CACnB,CAAC;EACH;EAEA,IAAII,gBAAgB,GAAGH,IAAI,CAACI,GAAG,CAACL,KAAK,GAAGN,IAAI,CAAC;EAE7C,IAAIM,KAAK,GAAG,CAAC,EACXI,gBAAgB,GAAGX,aAAa,GAAGW,gBAAgB;EAErD,IAAIP,gBAAgB,EAClBC,OAAO,CAACD,gBAAgB,CAAC,CAACG,KAAK,EAAEI,gBAAgB,CAAC;AACtD\"}"};function useOnProgressChange(opts){var autoFillData=opts.autoFillData,loop=opts.loop,offsetX=opts.offsetX,size=opts.size,rawDataLength=opts.rawDataLength,onProgressChange=opts.onProgressChange;(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _e=[new global.Error(),-2,-27];var _f=function _f(){return offsetX.value;};_f._closure={offsetX:offsetX};_f.__initData=_worklet_15415777011180_init_data;_f.__workletHash=15415777011180;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),function(){var _e=[new global.Error(),-8,-27];var _f=function _f(_value){var value=(0,_computedWithAutoFillData.computedOffsetXValueWithAutoFillData)({value:_value,rawDataLength:rawDataLength,size:size,autoFillData:autoFillData,loop:loop});if(!loop){value=Math.max(-((rawDataLength-1)*size),Math.min(value,0));}var absoluteProgress=Math.abs(value/size);if(value>0)absoluteProgress=rawDataLength-absoluteProgress;if(onProgressChange)(0,_reactNativeReanimated.runOnJS)(onProgressChange)(value,absoluteProgress);};_f._closure={computedOffsetXValueWithAutoFillData:_computedWithAutoFillData.computedOffsetXValueWithAutoFillData,rawDataLength:rawDataLength,size:size,autoFillData:autoFillData,loop:loop,onProgressChange:onProgressChange,runOnJS:_reactNativeReanimated.runOnJS};_f.__initData=_worklet_2512862808065_init_data;_f.__workletHash=2512862808065;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[loop,autoFillData,rawDataLength,onProgressChange]);}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useOnProgressChange = useOnProgressChange;
7
+
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+
10
+ var _computedWithAutoFillData = require("../utils/computed-with-auto-fill-data");
11
+
12
+ function useOnProgressChange(opts) {
13
+ const {
14
+ autoFillData,
15
+ loop,
16
+ offsetX,
17
+ size,
18
+ rawDataLength,
19
+ onProgressChange
20
+ } = opts;
21
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => offsetX.value, _value => {
22
+ let value = (0, _computedWithAutoFillData.computedOffsetXValueWithAutoFillData)({
23
+ value: _value,
24
+ rawDataLength,
25
+ size,
26
+ autoFillData,
27
+ loop
28
+ });
29
+
30
+ if (!loop) {
31
+ value = Math.max(-((rawDataLength - 1) * size), Math.min(value, 0));
32
+ }
33
+
34
+ let absoluteProgress = Math.abs(value / size);
35
+ if (value > 0) absoluteProgress = rawDataLength - absoluteProgress;
36
+ if (onProgressChange) (0, _reactNativeReanimated.runOnJS)(onProgressChange)(value, absoluteProgress);
37
+ }, [loop, autoFillData, rawDataLength, onProgressChange]);
38
+ }
2
39
  //# sourceMappingURL=useOnProgressChange.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useOnProgressChange.ts"],"names":["useOnProgressChange","opts","autoFillData","loop","offsetX","size","rawDataLength","onProgressChange","value","_value","Math","max","min","absoluteProgress","abs","computedOffsetXValueWithAutoFillData","runOnJS"],"mappings":"yGACA,8DAMA,2E,49EAEO,QAASA,CAAAA,mBAAT,CACLC,IADK,CAQL,CACA,GAAQC,CAAAA,YAAR,CACQD,IADR,CAAQC,YAAR,CAAsBC,IAAtB,CACQF,IADR,CAAsBE,IAAtB,CAA4BC,OAA5B,CACQH,IADR,CAA4BG,OAA5B,CAAqCC,IAArC,CACQJ,IADR,CAAqCI,IAArC,CAA2CC,aAA3C,CACQL,IADR,CAA2CK,aAA3C,CAA0DC,gBAA1D,CACQN,IADR,CAA0DM,gBAA1D,CAGA,oGACE,oBAAMH,CAAAA,OAAO,CAACI,KAAd,EADF,sBArBKJ,OAqBL,2MAEGK,MAFH,CAEc,CACV,GAAID,CAAAA,KAAK,CAAG,mEAAqC,CAC/CA,KAAK,CAAEC,MADwC,CAE/CH,aAAa,CAAbA,aAF+C,CAG/CD,IAAI,CAAJA,IAH+C,CAI/CH,YAAY,CAAZA,YAJ+C,CAK/CC,IAAI,CAAJA,IAL+C,CAArC,CAAZ,CAQA,GAAI,CAACA,IAAL,CAAW,CACTK,KAAK,CAAGE,IAAI,CAACC,GAAL,CACN,EAAE,CAACL,aAAa,CAAG,CAAjB,EAAsBD,IAAxB,CADM,CAENK,IAAI,CAACE,GAAL,CAASJ,KAAT,CAAgB,CAAhB,CAFM,CAAR,CAID,CAED,GAAIK,CAAAA,gBAAgB,CAAGH,IAAI,CAACI,GAAL,CAASN,KAAK,CAAGH,IAAjB,CAAvB,CAEA,GAAIG,KAAK,CAAG,CAAZ,CACEK,gBAAgB,CAAGP,aAAa,CAAGO,gBAAnC,CAEF,GAAIN,gBAAJ,CACE,mCAAQA,gBAAR,EAA0BC,KAA1B,CAAiCK,gBAAjC,EACH,CAzBH,mDApBYE,8DAoBZ,eATkCT,aASlC,MAVwCD,IAUxC,cAhBEH,YAgBF,MAbKC,IAaL,kBAR8BI,gBAQ9B,SARsBS,8BAQtB,wIA0BE,CAACb,IAAD,CAAOD,YAAP,CAAqBI,aAArB,CAAoCC,gBAApC,CA1BF,EA4BD","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport {\n runOnJS,\n useAnimatedReaction,\n} from \"react-native-reanimated\";\n\nimport type { TCarouselProps } from \"../types\";\nimport { computedOffsetXValueWithAutoFillData } from \"../utils/computedWithAutoFillData\";\n\nexport function useOnProgressChange(\n opts: {\n size: number\n autoFillData: boolean\n loop: boolean\n offsetX: Animated.SharedValue<number>\n rawDataLength: number\n } & Pick<TCarouselProps, \"onProgressChange\">,\n) {\n const { autoFillData, loop, offsetX, size, rawDataLength, onProgressChange }\n = opts;\n\n useAnimatedReaction(\n () => offsetX.value,\n (_value) => {\n let value = computedOffsetXValueWithAutoFillData({\n value: _value,\n rawDataLength,\n size,\n autoFillData,\n loop,\n });\n\n if (!loop) {\n value = Math.max(\n -((rawDataLength - 1) * size),\n Math.min(value, 0),\n );\n }\n\n let absoluteProgress = Math.abs(value / size);\n\n if (value > 0)\n absoluteProgress = rawDataLength - absoluteProgress;\n\n if (onProgressChange)\n runOnJS(onProgressChange)(value, absoluteProgress);\n },\n [loop, autoFillData, rawDataLength, onProgressChange],\n );\n}\n"]}
1
+ {"version":3,"sources":["useOnProgressChange.ts"],"names":["useOnProgressChange","opts","autoFillData","loop","offsetX","size","rawDataLength","onProgressChange","value","_value","Math","max","min","absoluteProgress","abs"],"mappings":";;;;;;;AACA;;AAMA;;AAEO,SAASA,mBAAT,CACLC,IADK,EAQL;AACA,QAAM;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA,IAAhB;AAAsBC,IAAAA,OAAtB;AAA+BC,IAAAA,IAA/B;AAAqCC,IAAAA,aAArC;AAAoDC,IAAAA;AAApD,MACEN,IADR;AAGA,kDACE,MAAMG,OAAO,CAACI,KADhB,EAEGC,MAAD,IAAY;AACV,QAAID,KAAK,GAAG,oEAAqC;AAC/CA,MAAAA,KAAK,EAAEC,MADwC;AAE/CH,MAAAA,aAF+C;AAG/CD,MAAAA,IAH+C;AAI/CH,MAAAA,YAJ+C;AAK/CC,MAAAA;AAL+C,KAArC,CAAZ;;AAQA,QAAI,CAACA,IAAL,EAAW;AACTK,MAAAA,KAAK,GAAGE,IAAI,CAACC,GAAL,CACN,EAAE,CAACL,aAAa,GAAG,CAAjB,IAAsBD,IAAxB,CADM,EAENK,IAAI,CAACE,GAAL,CAASJ,KAAT,EAAgB,CAAhB,CAFM,CAAR;AAID;;AAED,QAAIK,gBAAgB,GAAGH,IAAI,CAACI,GAAL,CAASN,KAAK,GAAGH,IAAjB,CAAvB;AAEA,QAAIG,KAAK,GAAG,CAAZ,EACEK,gBAAgB,GAAGP,aAAa,GAAGO,gBAAnC;AAEF,QAAIN,gBAAJ,EACE,oCAAQA,gBAAR,EAA0BC,KAA1B,EAAiCK,gBAAjC;AACH,GAzBH,EA0BE,CAACV,IAAD,EAAOD,YAAP,EAAqBI,aAArB,EAAoCC,gBAApC,CA1BF;AA4BD","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport {\n runOnJS,\n useAnimatedReaction,\n} from \"react-native-reanimated\";\n\nimport type { TCarouselProps } from \"../types\";\nimport { computedOffsetXValueWithAutoFillData } from \"../utils/computed-with-auto-fill-data\";\n\nexport function useOnProgressChange(\n opts: {\n size: number\n autoFillData: boolean\n loop: boolean\n offsetX: Animated.SharedValue<number>\n rawDataLength: number\n } & Pick<TCarouselProps, \"onProgressChange\">,\n) {\n const { autoFillData, loop, offsetX, size, rawDataLength, onProgressChange }\n = opts;\n\n useAnimatedReaction(\n () => offsetX.value,\n (_value) => {\n let value = computedOffsetXValueWithAutoFillData({\n value: _value,\n rawDataLength,\n size,\n autoFillData,\n loop,\n });\n\n if (!loop) {\n value = Math.max(\n -((rawDataLength - 1) * size),\n Math.min(value, 0),\n );\n }\n\n let absoluteProgress = Math.abs(value / size);\n\n if (value > 0)\n absoluteProgress = rawDataLength - absoluteProgress;\n\n if (onProgressChange)\n runOnJS(onProgressChange)(value, absoluteProgress);\n },\n [loop, autoFillData, rawDataLength, onProgressChange],\n );\n}\n"]}
@@ -1,2 +1,37 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.usePropsErrorBoundary=usePropsErrorBoundary;var _react=_interopRequireDefault(require("react"));function usePropsErrorBoundary(props){_react.default.useEffect(function(){var defaultIndex=props.defaultIndex,viewCount=props.dataLength;if(typeof defaultIndex==="number"&&viewCount>0){if(defaultIndex<0||defaultIndex>=viewCount){throw new Error("DefaultIndex must be in the range of data length.");}}if(!props.mode||props.mode==="parallax"){if(!props.vertical&&!props.width){throw new Error("`width` must be specified for horizontal carousels.");}if(props.vertical&&!props.height){throw new Error("`height` must be specified for vertical carousels.");}}},[props]);}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usePropsErrorBoundary = usePropsErrorBoundary;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ function usePropsErrorBoundary(props) {
13
+ _react.default.useEffect(() => {
14
+ const {
15
+ defaultIndex,
16
+ dataLength: viewCount
17
+ } = props;
18
+
19
+ if (typeof defaultIndex === "number" && viewCount > 0) {
20
+ if (defaultIndex < 0 || defaultIndex >= viewCount) {
21
+ throw new Error("DefaultIndex must be in the range of data length.");
22
+ }
23
+ } // TODO
24
+
25
+
26
+ if (!props.mode || props.mode === "parallax") {
27
+ if (!props.vertical && !props.width) {
28
+ throw new Error("`width` must be specified for horizontal carousels.");
29
+ }
30
+
31
+ if (props.vertical && !props.height) {
32
+ throw new Error("`height` must be specified for vertical carousels.");
33
+ }
34
+ }
35
+ }, [props]);
36
+ }
2
37
  //# sourceMappingURL=usePropsErrorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["usePropsErrorBoundary.ts"],"names":["usePropsErrorBoundary","props","React","useEffect","defaultIndex","viewCount","dataLength","Error","mode","vertical","width","height"],"mappings":"gMAAA,oDAIO,QAASA,CAAAA,qBAAT,CAA+BC,KAA/B,CAA+E,CACpFC,eAAMC,SAAN,CAAgB,UAAM,CACpB,GAAQC,CAAAA,YAAR,CAAgDH,KAAhD,CAAQG,YAAR,CAAkCC,SAAlC,CAAgDJ,KAAhD,CAAsBK,UAAtB,CAEA,GAAI,MAAOF,CAAAA,YAAP,GAAwB,QAAxB,EAAoCC,SAAS,CAAG,CAApD,CAAuD,CACrD,GAAID,YAAY,CAAG,CAAf,EAAoBA,YAAY,EAAIC,SAAxC,CAAmD,CACjD,KAAM,IAAIE,CAAAA,KAAJ,CACJ,mDADI,CAAN,CAGD,CACF,CAGD,GAAI,CAACN,KAAK,CAACO,IAAP,EAAeP,KAAK,CAACO,IAAN,GAAe,UAAlC,CAA8C,CAC5C,GAAI,CAACP,KAAK,CAACQ,QAAP,EAAmB,CAACR,KAAK,CAACS,KAA9B,CAAqC,CACnC,KAAM,IAAIH,CAAAA,KAAJ,CACJ,qDADI,CAAN,CAGD,CACD,GAAIN,KAAK,CAACQ,QAAN,EAAkB,CAACR,KAAK,CAACU,MAA7B,CAAqC,CACnC,KAAM,IAAIJ,CAAAA,KAAJ,CACJ,oDADI,CAAN,CAGD,CACF,CACF,CAxBD,CAwBG,CAACN,KAAD,CAxBH,EAyBD","sourcesContent":["import React from \"react\";\n\nimport type { TCarouselProps } from \"../types\";\n\nexport function usePropsErrorBoundary(props: TCarouselProps & { dataLength: number }) {\n React.useEffect(() => {\n const { defaultIndex, dataLength: viewCount } = props;\n\n if (typeof defaultIndex === \"number\" && viewCount > 0) {\n if (defaultIndex < 0 || defaultIndex >= viewCount) {\n throw new Error(\n \"DefaultIndex must be in the range of data length.\",\n );\n }\n }\n\n // TODO\n if (!props.mode || props.mode === \"parallax\") {\n if (!props.vertical && !props.width) {\n throw new Error(\n \"`width` must be specified for horizontal carousels.\",\n );\n }\n if (props.vertical && !props.height) {\n throw new Error(\n \"`height` must be specified for vertical carousels.\",\n );\n }\n }\n }, [props]);\n}\n"]}
1
+ {"version":3,"sources":["usePropsErrorBoundary.ts"],"names":["usePropsErrorBoundary","props","React","useEffect","defaultIndex","dataLength","viewCount","Error","mode","vertical","width","height"],"mappings":";;;;;;;AAAA;;;;AAIO,SAASA,qBAAT,CAA+BC,KAA/B,EAA+E;AACpFC,iBAAMC,SAAN,CAAgB,MAAM;AACpB,UAAM;AAAEC,MAAAA,YAAF;AAAgBC,MAAAA,UAAU,EAAEC;AAA5B,QAA0CL,KAAhD;;AAEA,QAAI,OAAOG,YAAP,KAAwB,QAAxB,IAAoCE,SAAS,GAAG,CAApD,EAAuD;AACrD,UAAIF,YAAY,GAAG,CAAf,IAAoBA,YAAY,IAAIE,SAAxC,EAAmD;AACjD,cAAM,IAAIC,KAAJ,CACJ,mDADI,CAAN;AAGD;AACF,KATmB,CAWpB;;;AACA,QAAI,CAACN,KAAK,CAACO,IAAP,IAAeP,KAAK,CAACO,IAAN,KAAe,UAAlC,EAA8C;AAC5C,UAAI,CAACP,KAAK,CAACQ,QAAP,IAAmB,CAACR,KAAK,CAACS,KAA9B,EAAqC;AACnC,cAAM,IAAIH,KAAJ,CACJ,qDADI,CAAN;AAGD;;AACD,UAAIN,KAAK,CAACQ,QAAN,IAAkB,CAACR,KAAK,CAACU,MAA7B,EAAqC;AACnC,cAAM,IAAIJ,KAAJ,CACJ,oDADI,CAAN;AAGD;AACF;AACF,GAxBD,EAwBG,CAACN,KAAD,CAxBH;AAyBD","sourcesContent":["import React from \"react\";\n\nimport type { TCarouselProps } from \"../types\";\n\nexport function usePropsErrorBoundary(props: TCarouselProps & { dataLength: number }) {\n React.useEffect(() => {\n const { defaultIndex, dataLength: viewCount } = props;\n\n if (typeof defaultIndex === \"number\" && viewCount > 0) {\n if (defaultIndex < 0 || defaultIndex >= viewCount) {\n throw new Error(\n \"DefaultIndex must be in the range of data length.\",\n );\n }\n }\n\n // TODO\n if (!props.mode || props.mode === \"parallax\") {\n if (!props.vertical && !props.width) {\n throw new Error(\n \"`width` must be specified for horizontal carousels.\",\n );\n }\n if (props.vertical && !props.height) {\n throw new Error(\n \"`height` must be specified for vertical carousels.\",\n );\n }\n }\n }, [props]);\n}\n"]}
@@ -0,0 +1,20 @@
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;
20
+ //# sourceMappingURL=useUpdateGestureConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useUpdateGestureConfig.ts"],"names":["useUpdateGestureConfig","gesture","config","enabled"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,CAACC,OAAD,EAAsBC,MAAtB,KAEhC;AACJ,QAAM;AAAEC,IAAAA;AAAF,MAAcD,MAApB;AAEA,wBAAU,MAAM;AACd,QAAI,OAAOC,OAAP,KAAmB,WAAvB,EACEF,OAAO,CAACE,OAAR,CAAgBA,OAAhB;AACH,GAHD,EAGG,CAACA,OAAD,EAAUF,OAAV,CAHH;AAID,CATM","sourcesContent":["import { useEffect } from \"react\";\nimport type { PanGesture } from \"react-native-gesture-handler\";\n\nexport const useUpdateGestureConfig = (gesture: PanGesture, config: {\n enabled?: boolean\n}) => {\n const { enabled } = config;\n\n useEffect(() => {\n if (typeof enabled !== \"undefined\")\n gesture.enabled(enabled);\n }, [enabled, gesture]);\n};\n"]}
@@ -1,2 +1,43 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.useVisibleRanges=useVisibleRanges;var _reactNativeReanimated=require("react-native-reanimated");var _worklet_1686155145629_init_data={code:"function anonymous() {\n const {\n windowSize,\n translation,\n viewSize,\n total\n } = this._closure;\n const positiveCount = Math.round(windowSize / 2);\n const negativeCount = windowSize - positiveCount;\n let curIndex = Math.round(-translation.value / viewSize);\n curIndex = curIndex < 0 ? curIndex % total + total : curIndex;\n const negativeRange = [(curIndex - negativeCount + total) % total, (curIndex - 1 + total) % total];\n const positiveRange = [(curIndex + total) % total, (curIndex + positiveCount + total) % total];\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 return {\n negativeRange: negativeRange,\n positiveRange: positiveRange\n };\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"windowSize\",\"translation\",\"viewSize\",\"total\",\"_closure\",\"positiveCount\",\"Math\",\"round\",\"negativeCount\",\"curIndex\",\"value\",\"negativeRange\",\"positiveRange\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/hooks/useVisibleRanges.tsx\"],\"mappings\":\"AAuBiC,SAAAA,SAAMA,CAAA;EAAA;IAAAC,UAAA;IAAAC,WAAA;IAAAC,QAAA;IAAAC;EAAA,SAAAC,QAAA;EACnC,MAAMC,aAAa,GAAGC,IAAI,CAACC,KAAK,CAACP,UAAU,GAAG,CAAC,CAAC;EAChD,MAAMQ,aAAa,GAAGR,UAAU,GAAGK,aAAa;EAChD,IAAII,QAAQ,GAAGH,IAAI,CAACC,KAAK,CAAC,CAACN,WAAW,CAACS,KAAK,GAAGR,QAAQ,CAAC;EACxDO,QAAQ,GAAGA,QAAQ,GAAG,CAAC,GAAIA,QAAQ,GAAGN,KAAK,GAAIA,KAAK,GAAGM,QAAQ;EAC/D,MAAME,aAAa,GAAG,CACpB,CAACF,QAAQ,GAAGD,aAAa,GAAGL,KAAK,IAAIA,KAAK,EAC1C,CAACM,QAAQ,GAAG,CAAC,GAAGN,KAAK,IAAIA,KAAK,CAC/B;EACD,MAAMS,aAAa,GAAG,CACpB,CAACH,QAAQ,GAAGN,KAAK,IAAIA,KAAK,EAC1B,CAACM,QAAQ,GAAGJ,aAAa,GAAGF,KAAK,IAAIA,KAAK,CAC3C;EACD,IAAIQ,aAAa,CAAC,CAAC,CAAC,GAAGR,KAAK,IAAIQ,aAAa,CAAC,CAAC,CAAC,GAAGA,aAAa,CAAC,CAAC,CAAC,EAAE;IACnEA,aAAa,CAAC,CAAC,CAAC,GAAGR,KAAK,GAAG,CAAC;IAC5BS,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;EACtB;EACA,IAAIA,aAAa,CAAC,CAAC,CAAC,GAAGA,aAAa,CAAC,CAAC,CAAC,EAAE;IACvCD,aAAa,CAAC,CAAC,CAAC,GAAGR,KAAK,GAAG,CAAC;IAC5BS,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;EACtB;EACA,OAAO;IAAED,aAAa,EAAbA,aAAa;IAAEC,aAAA,EAAAA;EAAc,CAAC;AACzC\"}"};function useVisibleRanges(options){var _options$total=options.total,total=_options$total===void 0?0:_options$total,viewSize=options.viewSize,translation=options.translation,_options$windowSize=options.windowSize,_windowSize=_options$windowSize===void 0?0:_options$windowSize;var windowSize=total<=_windowSize?total:_windowSize;var ranges=(0,_reactNativeReanimated.useDerivedValue)(function(){var _e=[new global.Error(),-5,-27];var _f=function _f(){var positiveCount=Math.round(windowSize/2);var negativeCount=windowSize-positiveCount;var curIndex=Math.round(-translation.value/viewSize);curIndex=curIndex<0?curIndex%total+total:curIndex;var negativeRange=[(curIndex-negativeCount+total)%total,(curIndex-1+total)%total];var positiveRange=[(curIndex+total)%total,(curIndex+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;}return{negativeRange:negativeRange,positiveRange:positiveRange};};_f._closure={windowSize:windowSize,translation:translation,viewSize:viewSize,total:total};_f.__initData=_worklet_1686155145629_init_data;_f.__workletHash=1686155145629;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[total,windowSize,translation]);return ranges;}
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useVisibleRanges = useVisibleRanges;
7
+
8
+ var _reactNativeReanimated = require("react-native-reanimated");
9
+
10
+ function useVisibleRanges(options) {
11
+ const {
12
+ total = 0,
13
+ viewSize,
14
+ translation,
15
+ windowSize: _windowSize = 0
16
+ } = options;
17
+ const windowSize = total <= _windowSize ? total : _windowSize;
18
+ const ranges = (0, _reactNativeReanimated.useDerivedValue)(() => {
19
+ const positiveCount = Math.round(windowSize / 2);
20
+ const negativeCount = windowSize - positiveCount;
21
+ let curIndex = Math.round(-translation.value / viewSize);
22
+ curIndex = curIndex < 0 ? curIndex % total + total : curIndex;
23
+ const negativeRange = [(curIndex - negativeCount + total) % total, (curIndex - 1 + total) % total];
24
+ const positiveRange = [(curIndex + total) % total, (curIndex + positiveCount + total) % total];
25
+
26
+ if (negativeRange[0] < total && negativeRange[0] > negativeRange[1]) {
27
+ negativeRange[1] = total - 1;
28
+ positiveRange[0] = 0;
29
+ }
30
+
31
+ if (positiveRange[0] > positiveRange[1]) {
32
+ negativeRange[1] = total - 1;
33
+ positiveRange[0] = 0;
34
+ }
35
+
36
+ return {
37
+ negativeRange,
38
+ positiveRange
39
+ };
40
+ }, [total, windowSize, translation]);
41
+ return ranges;
42
+ }
2
43
  //# sourceMappingURL=useVisibleRanges.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useVisibleRanges.tsx"],"names":["useVisibleRanges","options","total","viewSize","translation","windowSize","_windowSize","ranges","positiveCount","Math","round","negativeCount","curIndex","value","negativeRange","positiveRange"],"mappings":"mGACA,8D,m5EAOO,QAASA,CAAAA,gBAAT,CAA0BC,OAA1B,CAKY,CACjB,mBAKIA,OALJ,CACEC,KADF,CACEA,KADF,yBACU,CADV,gBAEEC,QAFF,CAKIF,OALJ,CAEEE,QAFF,CAGEC,WAHF,CAKIH,OALJ,CAGEG,WAHF,qBAKIH,OALJ,CAIEI,UAJF,CAIcC,WAJd,8BAI4B,CAJ5B,qBAOA,GAAMD,CAAAA,UAAU,CAAGH,KAAK,EAAII,WAAT,CAAuBJ,KAAvB,CAA+BI,WAAlD,CAEA,GAAMC,CAAAA,MAAM,CAAG,6GAAsB,CACnC,GAAMC,CAAAA,aAAa,CAAGC,IAAI,CAACC,KAAL,CAAWL,UAAU,CAAG,CAAxB,CAAtB,CACA,GAAMM,CAAAA,aAAa,CAAGN,UAAU,CAAGG,aAAnC,CACA,GAAII,CAAAA,QAAQ,CAAGH,IAAI,CAACC,KAAL,CAAW,CAACN,WAAW,CAACS,KAAb,CAAqBV,QAAhC,CAAf,CACAS,QAAQ,CAAGA,QAAQ,CAAG,CAAX,CAAgBA,QAAQ,CAAGV,KAAZ,CAAqBA,KAApC,CAA4CU,QAAvD,CACA,GAAME,CAAAA,aAAa,CAAG,CACpB,CAACF,QAAQ,CAAGD,aAAX,CAA2BT,KAA5B,EAAqCA,KADjB,CAEpB,CAACU,QAAQ,CAAG,CAAX,CAAeV,KAAhB,EAAyBA,KAFL,CAAtB,CAIA,GAAMa,CAAAA,aAAa,CAAG,CACpB,CAACH,QAAQ,CAAGV,KAAZ,EAAqBA,KADD,CAEpB,CAACU,QAAQ,CAAGJ,aAAX,CAA2BN,KAA5B,EAAqCA,KAFjB,CAAtB,CAIA,GAAIY,aAAa,CAAC,CAAD,CAAb,CAAmBZ,KAAnB,EAA4BY,aAAa,CAAC,CAAD,CAAb,CAAmBA,aAAa,CAAC,CAAD,CAAhE,CAAqE,CACnEA,aAAa,CAAC,CAAD,CAAb,CAAmBZ,KAAK,CAAG,CAA3B,CACAa,aAAa,CAAC,CAAD,CAAb,CAAmB,CAAnB,CACD,CACD,GAAIA,aAAa,CAAC,CAAD,CAAb,CAAmBA,aAAa,CAAC,CAAD,CAApC,CAAyC,CACvCD,aAAa,CAAC,CAAD,CAAb,CAAmBZ,KAAK,CAAG,CAA3B,CACAa,aAAa,CAAC,CAAD,CAAb,CAAmB,CAAnB,CACD,CACD,MAAO,CAAED,aAAa,CAAbA,aAAF,CAAiBC,aAAa,CAAbA,aAAjB,CAAP,CACD,CAtBc,yBArBOV,UAqBP,aApBYD,WAoBZ,UApBgCD,QAoBhC,OAXMD,KAWN,wIAsBZ,CAACA,KAAD,CAAQG,UAAR,CAAoBD,WAApB,CAtBY,CAAf,CAwBA,MAAOG,CAAAA,MAAP,CACD","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport { useDerivedValue } from \"react-native-reanimated\";\n\nexport type IVisibleRanges = Animated.SharedValue<{\n negativeRange: number[]\n positiveRange: number[]\n}>;\n\nexport function useVisibleRanges(options: {\n total: number\n viewSize: number\n windowSize?: number\n translation: Animated.SharedValue<number>\n}): IVisibleRanges {\n const {\n total = 0,\n viewSize,\n translation,\n windowSize: _windowSize = 0,\n } = options;\n\n const windowSize = total <= _windowSize ? total : _windowSize;\n\n const ranges = useDerivedValue(() => {\n const positiveCount = Math.round(windowSize / 2);\n const negativeCount = windowSize - positiveCount;\n let curIndex = Math.round(-translation.value / viewSize);\n curIndex = curIndex < 0 ? (curIndex % total) + total : curIndex;\n const negativeRange = [\n (curIndex - negativeCount + total) % total,\n (curIndex - 1 + total) % total,\n ];\n const positiveRange = [\n (curIndex + total) % total,\n (curIndex + positiveCount + total) % total,\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 return { negativeRange, positiveRange };\n }, [total, windowSize, translation]);\n\n return ranges;\n}\n"]}
1
+ {"version":3,"sources":["useVisibleRanges.tsx"],"names":["useVisibleRanges","options","total","viewSize","translation","windowSize","_windowSize","ranges","positiveCount","Math","round","negativeCount","curIndex","value","negativeRange","positiveRange"],"mappings":";;;;;;;AACA;;AAOO,SAASA,gBAAT,CAA0BC,OAA1B,EAKY;AACjB,QAAM;AACJC,IAAAA,KAAK,GAAG,CADJ;AAEJC,IAAAA,QAFI;AAGJC,IAAAA,WAHI;AAIJC,IAAAA,UAAU,EAAEC,WAAW,GAAG;AAJtB,MAKFL,OALJ;AAOA,QAAMI,UAAU,GAAGH,KAAK,IAAII,WAAT,GAAuBJ,KAAvB,GAA+BI,WAAlD;AAEA,QAAMC,MAAM,GAAG,4CAAgB,MAAM;AACnC,UAAMC,aAAa,GAAGC,IAAI,CAACC,KAAL,CAAWL,UAAU,GAAG,CAAxB,CAAtB;AACA,UAAMM,aAAa,GAAGN,UAAU,GAAGG,aAAnC;AACA,QAAII,QAAQ,GAAGH,IAAI,CAACC,KAAL,CAAW,CAACN,WAAW,CAACS,KAAb,GAAqBV,QAAhC,CAAf;AACAS,IAAAA,QAAQ,GAAGA,QAAQ,GAAG,CAAX,GAAgBA,QAAQ,GAAGV,KAAZ,GAAqBA,KAApC,GAA4CU,QAAvD;AACA,UAAME,aAAa,GAAG,CACpB,CAACF,QAAQ,GAAGD,aAAX,GAA2BT,KAA5B,IAAqCA,KADjB,EAEpB,CAACU,QAAQ,GAAG,CAAX,GAAeV,KAAhB,IAAyBA,KAFL,CAAtB;AAIA,UAAMa,aAAa,GAAG,CACpB,CAACH,QAAQ,GAAGV,KAAZ,IAAqBA,KADD,EAEpB,CAACU,QAAQ,GAAGJ,aAAX,GAA2BN,KAA5B,IAAqCA,KAFjB,CAAtB;;AAIA,QAAIY,aAAa,CAAC,CAAD,CAAb,GAAmBZ,KAAnB,IAA4BY,aAAa,CAAC,CAAD,CAAb,GAAmBA,aAAa,CAAC,CAAD,CAAhE,EAAqE;AACnEA,MAAAA,aAAa,CAAC,CAAD,CAAb,GAAmBZ,KAAK,GAAG,CAA3B;AACAa,MAAAA,aAAa,CAAC,CAAD,CAAb,GAAmB,CAAnB;AACD;;AACD,QAAIA,aAAa,CAAC,CAAD,CAAb,GAAmBA,aAAa,CAAC,CAAD,CAApC,EAAyC;AACvCD,MAAAA,aAAa,CAAC,CAAD,CAAb,GAAmBZ,KAAK,GAAG,CAA3B;AACAa,MAAAA,aAAa,CAAC,CAAD,CAAb,GAAmB,CAAnB;AACD;;AACD,WAAO;AAAED,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,KAAP;AACD,GAtBc,EAsBZ,CAACb,KAAD,EAAQG,UAAR,EAAoBD,WAApB,CAtBY,CAAf;AAwBA,SAAOG,MAAP;AACD","sourcesContent":["import type Animated from \"react-native-reanimated\";\nimport { useDerivedValue } from \"react-native-reanimated\";\n\nexport type IVisibleRanges = Animated.SharedValue<{\n negativeRange: number[]\n positiveRange: number[]\n}>;\n\nexport function useVisibleRanges(options: {\n total: number\n viewSize: number\n windowSize?: number\n translation: Animated.SharedValue<number>\n}): IVisibleRanges {\n const {\n total = 0,\n viewSize,\n translation,\n windowSize: _windowSize = 0,\n } = options;\n\n const windowSize = total <= _windowSize ? total : _windowSize;\n\n const ranges = useDerivedValue(() => {\n const positiveCount = Math.round(windowSize / 2);\n const negativeCount = windowSize - positiveCount;\n let curIndex = Math.round(-translation.value / viewSize);\n curIndex = curIndex < 0 ? (curIndex % total) + total : curIndex;\n const negativeRange = [\n (curIndex - negativeCount + total) % total,\n (curIndex - 1 + total) % total,\n ];\n const positiveRange = [\n (curIndex + total) % total,\n (curIndex + positiveCount + total) % total,\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 return { negativeRange, positiveRange };\n }, [total, windowSize, translation]);\n\n return ranges;\n}\n"]}
@@ -1,2 +1,14 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"ILayoutConfig",{enumerable:true,get:function get(){return _stack.ILayoutConfig;}});exports.default=void 0;var _Carousel=_interopRequireDefault(require("./Carousel"));var _stack=require("./layouts/stack");var _default=_Carousel.default;exports.default=_default;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _Carousel = _interopRequireDefault(require("./components/Carousel"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _Carousel.default;
13
+ exports.default = _default;
2
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["Carousel"],"mappings":"qRAAA,4DAOA,sC,aAEeA,iB","sourcesContent":["import Carousel from \"./Carousel\";\nexport type {\n TCarouselProps,\n ICarouselInstance,\n IComputedDirectionTypes,\n CarouselRenderItem,\n} from \"./types\";\nexport { ILayoutConfig } from \"./layouts/stack\";\n\nexport default Carousel;\n"]}
1
+ {"version":3,"sources":["index.tsx"],"names":["Carousel"],"mappings":";;;;;;;AAAA;;;;eASeA,iB","sourcesContent":["import Carousel from \"./components/Carousel\";\nexport type {\n TCarouselProps,\n ICarouselInstance,\n IComputedDirectionTypes,\n CarouselRenderItem,\n} from \"./types\";\nexport type { ILayoutConfig } from \"./layouts/stack\";\n\nexport default Carousel;\n"]}
@@ -1,2 +1,111 @@
1
- var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.BaseLayout=void 0;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireDefault(require("react"));var _reactNativeReanimated=_interopRequireWildcard(require("react-native-reanimated"));var _useCheckMounted=require("../hooks/useCheckMounted");var _useOffsetX=require("../hooks/useOffsetX");var _LazyView=require("../LazyView");var _store=require("../store");var _jsxRuntime=require("react/jsx-runtime");var _this=this,_jsxFileName="/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var _worklet_3217166169285_init_data={code:"function anonymous() {\n const {\n x,\n size\n } = this._closure;\n return x.value / size;\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"x\",\"size\",\"_closure\",\"value\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx\"],\"mappings\":\"AAyEyC,SAAAA,UAAA;EAAA;IAAAC,CAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAOF,CAAC,CAAAG,KAAK,GAAGF,IAAA;AAAA\"}"};var _worklet_11301275444738_init_data={code:"function anonymous() {\n const {\n animationStyle,\n x,\n size\n } = this._closure;\n return animationStyle(x.value / size);\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"animationStyle\",\"x\",\"size\",\"_closure\",\"value\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx\"],\"mappings\":\"AA2EI,SAAAA,UAAA;EAAA;IAAAC,cAAA;IAAAC,CAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAMH,cAAe,CAACC,CAAC,CAAAG,KAAK,GAAGF,IAAI;AAAA\"}"};var _worklet_11113070436332_init_data={code:"function anonymous() {\n const {\n visibleRanges\n } = this._closure;\n return visibleRanges.value;\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"visibleRanges\",\"_closure\",\"value\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx\"],\"mappings\":\"AA2FI,SAAAA,UAAA;EAAA;IAAAC;EAAA,SAAAC,QAAA;EAAA,OAAMD,aAAc,CAAAE,KAAA;AAAA\"}"};var _worklet_15128277149381_init_data={code:"function anonymous() {\n const {\n runOnJS,\n updateView,\n visibleRanges\n } = this._closure;\n runOnJS(updateView)(visibleRanges.value.negativeRange, visibleRanges.value.positiveRange);\n}",location:"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx",sourceMap:"{\"version\":3,\"names\":[\"anonymous\",\"runOnJS\",\"updateView\",\"visibleRanges\",\"_closure\",\"value\",\"negativeRange\",\"positiveRange\"],\"sources\":[\"/home/runner/work/react-native-reanimated-carousel/react-native-reanimated-carousel/src/layouts/BaseLayout.tsx\"],\"mappings\":\"AA4FI,SAAAA,SAAMA,CAAA;EAAA;IAAAC,OAAA;IAAAC,UAAA;IAAAC;EAAA,SAAAC,QAAA;EACJH,OAAO,CAACC,UAAU,CAAC,CACjBC,aAAa,CAACE,KAAK,CAACC,aAAa,EACjCH,aAAa,CAACE,KAAK,CAACE,aACtB,CAAC;AACH\"}"};var BaseLayout=function BaseLayout(props){var mounted=(0,_useCheckMounted.useCheckMounted)();var handlerOffset=props.handlerOffset,index=props.index,children=props.children,visibleRanges=props.visibleRanges,animationStyle=props.animationStyle;var context=_react.default.useContext(_store.CTX);var _context$props=context.props,loop=_context$props.loop,dataLength=_context$props.dataLength,width=_context$props.width,height=_context$props.height,vertical=_context$props.vertical,customConfig=_context$props.customConfig,mode=_context$props.mode,modeConfig=_context$props.modeConfig;var size=vertical?height:width;var _React$useState=_react.default.useState(false),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),shouldUpdate=_React$useState2[0],setShouldUpdate=_React$useState2[1];var offsetXConfig=Object.assign({handlerOffset:handlerOffset,index:index,size:size,dataLength:dataLength,loop:loop},typeof customConfig==="function"?customConfig():{});if(mode==="horizontal-stack"){var _ref=modeConfig,snapDirection=_ref.snapDirection,showLength=_ref.showLength;offsetXConfig={handlerOffset:handlerOffset,index:index,size:size,dataLength:dataLength,loop:loop,type:snapDirection==="right"?"negative":"positive",viewCount:showLength};}var x=(0,_useOffsetX.useOffsetX)(offsetXConfig,visibleRanges);var animationValue=(0,_reactNativeReanimated.useDerivedValue)(function(){var _e=[new global.Error(),-3,-27];var _f=function _f(){return x.value/size;};_f._closure={x:x,size:size};_f.__initData=_worklet_3217166169285_init_data;_f.__workletHash=3217166169285;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[x,size]);var animatedStyle=(0,_reactNativeReanimated.useAnimatedStyle)(function(){var _e=[new global.Error(),-4,-27];var _f=function _f(){return animationStyle(x.value/size);};_f._closure={animationStyle:animationStyle,x:x,size:size};_f.__initData=_worklet_11301275444738_init_data;_f.__workletHash=11301275444738;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[animationStyle]);var updateView=_react.default.useCallback(function(negativeRange,positiveRange){mounted.current&&setShouldUpdate(index>=negativeRange[0]&&index<=negativeRange[1]||index>=positiveRange[0]&&index<=positiveRange[1]);},[index,mounted]);(0,_reactNativeReanimated.useAnimatedReaction)(function(){var _e=[new global.Error(),-2,-27];var _f=function _f(){return visibleRanges.value;};_f._closure={visibleRanges:visibleRanges};_f.__initData=_worklet_11113070436332_init_data;_f.__workletHash=11113070436332;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),function(){var _e=[new global.Error(),-4,-27];var _f=function _f(){(0,_reactNativeReanimated.runOnJS)(updateView)(visibleRanges.value.negativeRange,visibleRanges.value.positiveRange);};_f._closure={runOnJS:_reactNativeReanimated.runOnJS,updateView:updateView,visibleRanges:visibleRanges};_f.__initData=_worklet_15128277149381_init_data;_f.__workletHash=15128277149381;_f.__stackDetails=_e;_f.__version="3.3.0";return _f;}(),[visibleRanges.value]);return(0,_jsxRuntime.jsx)(_reactNativeReanimated.default.View,{style:[{width:width||"100%",height:height||"100%",position:"absolute"},animatedStyle],testID:`__CAROUSEL_ITEM_${index}_${shouldUpdate?"READY":"NOT_READY"}__`,children:(0,_jsxRuntime.jsx)(_LazyView.LazyView,{shouldUpdate:shouldUpdate,children:children({animationValue:animationValue})})});};exports.BaseLayout=BaseLayout;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BaseLayout = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
+
12
+ var _LazyView = require("../components/LazyView");
13
+
14
+ var _useCheckMounted = require("../hooks/useCheckMounted");
15
+
16
+ var _useOffsetX = require("../hooks/useOffsetX");
17
+
18
+ var _store = require("../store");
19
+
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+
24
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+
26
+ const BaseLayout = props => {
27
+ const mounted = (0, _useCheckMounted.useCheckMounted)();
28
+ const {
29
+ handlerOffset,
30
+ index,
31
+ children,
32
+ visibleRanges,
33
+ animationStyle
34
+ } = props;
35
+
36
+ const context = _react.default.useContext(_store.CTX);
37
+
38
+ const {
39
+ props: {
40
+ loop,
41
+ dataLength,
42
+ width,
43
+ height,
44
+ vertical,
45
+ customConfig,
46
+ mode,
47
+ modeConfig
48
+ }
49
+ } = context;
50
+ const size = vertical ? height : width;
51
+
52
+ const [shouldUpdate, setShouldUpdate] = _react.default.useState(false);
53
+
54
+ let offsetXConfig = {
55
+ handlerOffset,
56
+ index,
57
+ size,
58
+ dataLength,
59
+ loop,
60
+ ...(typeof customConfig === "function" ? customConfig() : {})
61
+ };
62
+
63
+ if (mode === "horizontal-stack") {
64
+ const {
65
+ snapDirection,
66
+ showLength
67
+ } = modeConfig;
68
+ offsetXConfig = {
69
+ handlerOffset,
70
+ index,
71
+ size,
72
+ dataLength,
73
+ loop,
74
+ type: snapDirection === "right" ? "negative" : "positive",
75
+ viewCount: showLength
76
+ };
77
+ }
78
+
79
+ const x = (0, _useOffsetX.useOffsetX)(offsetXConfig, visibleRanges);
80
+ const animationValue = (0, _reactNativeReanimated.useDerivedValue)(() => x.value / size, [x, size]);
81
+ const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => animationStyle(x.value / size), [animationStyle]);
82
+
83
+ const updateView = _react.default.useCallback((negativeRange, positiveRange) => {
84
+ mounted.current && setShouldUpdate(index >= negativeRange[0] && index <= negativeRange[1] || index >= positiveRange[0] && index <= positiveRange[1]);
85
+ }, [index, mounted]);
86
+
87
+ (0, _reactNativeReanimated.useAnimatedReaction)(() => visibleRanges.value, () => {
88
+ (0, _reactNativeReanimated.runOnJS)(updateView)(visibleRanges.value.negativeRange, visibleRanges.value.positiveRange);
89
+ }, [visibleRanges.value]);
90
+ return /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
91
+ style: [{
92
+ width: width || "100%",
93
+ height: height || "100%",
94
+ position: "absolute"
95
+ }, animatedStyle]
96
+ /**
97
+ * We use this testID to know when the carousel item is ready to be tested in test.
98
+ * e.g.
99
+ * The testID of first item will be changed to __CAROUSEL_ITEM_0_READY__ from __CAROUSEL_ITEM_0_NOT_READY__ when the item is ready.
100
+ * */
101
+ ,
102
+ testID: `__CAROUSEL_ITEM_${index}_${shouldUpdate ? "READY" : "NOT_READY"}__`
103
+ }, /*#__PURE__*/_react.default.createElement(_LazyView.LazyView, {
104
+ shouldUpdate: shouldUpdate
105
+ }, children({
106
+ animationValue
107
+ })));
108
+ };
109
+
110
+ exports.BaseLayout = BaseLayout;
2
111
  //# sourceMappingURL=BaseLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["BaseLayout.tsx"],"names":["BaseLayout","props","mounted","handlerOffset","index","children","visibleRanges","animationStyle","context","React","useContext","CTX","loop","dataLength","width","height","vertical","customConfig","mode","modeConfig","size","useState","shouldUpdate","setShouldUpdate","offsetXConfig","snapDirection","showLength","type","viewCount","x","animationValue","value","animatedStyle","updateView","useCallback","negativeRange","positiveRange","current","runOnJS","position"],"mappings":"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","sourcesContent":["import React from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport type { AnimatedStyleProp } from \"react-native-reanimated\";\nimport Animated, {\n runOnJS,\n useAnimatedReaction,\n useAnimatedStyle,\n useDerivedValue,\n} from \"react-native-reanimated\";\n\nimport type { ILayoutConfig } from \"./stack\";\n\nimport { useCheckMounted } from \"../hooks/useCheckMounted\";\nimport type { IOpts } from \"../hooks/useOffsetX\";\nimport { useOffsetX } from \"../hooks/useOffsetX\";\nimport type { IVisibleRanges } from \"../hooks/useVisibleRanges\";\nimport { LazyView } from \"../LazyView\";\nimport { CTX } from \"../store\";\n\nexport type TAnimationStyle = (value: number) => AnimatedStyleProp<ViewStyle>;\n\nexport const BaseLayout: React.FC<{\n index: number\n handlerOffset: Animated.SharedValue<number>\n visibleRanges: IVisibleRanges\n animationStyle: TAnimationStyle\n children: (ctx: {\n animationValue: Animated.SharedValue<number>\n }) => React.ReactElement\n}> = (props) => {\n const mounted = useCheckMounted();\n const { handlerOffset, index, children, visibleRanges, animationStyle }\n = props;\n\n const context = React.useContext(CTX);\n const {\n props: {\n loop,\n dataLength,\n width,\n height,\n vertical,\n customConfig,\n mode,\n modeConfig,\n },\n } = context;\n const size = vertical ? height : width;\n const [shouldUpdate, setShouldUpdate] = React.useState(false);\n let offsetXConfig: IOpts = {\n handlerOffset,\n index,\n size,\n dataLength,\n loop,\n ...(typeof customConfig === \"function\" ? customConfig() : {}),\n };\n\n if (mode === \"horizontal-stack\") {\n const { snapDirection, showLength } = modeConfig as ILayoutConfig;\n\n offsetXConfig = {\n handlerOffset,\n index,\n size,\n dataLength,\n loop,\n type: snapDirection === \"right\" ? \"negative\" : \"positive\",\n viewCount: showLength,\n };\n }\n\n const x = useOffsetX(offsetXConfig, visibleRanges);\n const animationValue = useDerivedValue(() => x.value / size, [x, size]);\n const animatedStyle = useAnimatedStyle(\n () => animationStyle(x.value / size),\n [animationStyle],\n );\n\n const updateView = React.useCallback(\n (negativeRange: number[], positiveRange: number[]) => {\n mounted.current\n && setShouldUpdate(\n (index >= negativeRange[0] && index <= negativeRange[1])\n || (index >= positiveRange[0] && index <= positiveRange[1]),\n );\n },\n [index, mounted],\n );\n\n useAnimatedReaction(\n () => visibleRanges.value,\n () => {\n runOnJS(updateView)(\n visibleRanges.value.negativeRange,\n visibleRanges.value.positiveRange,\n );\n },\n [visibleRanges.value],\n );\n\n return (\n <Animated.View\n style={[\n {\n width: width || \"100%\",\n height: height || \"100%\",\n position: \"absolute\",\n },\n animatedStyle,\n ]}\n /**\n * We use this testID to know when the carousel item is ready to be tested in test.\n * e.g.\n * The testID of first item will be changed to __CAROUSEL_ITEM_0_READY__ from __CAROUSEL_ITEM_0_NOT_READY__ when the item is ready.\n * */\n testID={`__CAROUSEL_ITEM_${index}_${shouldUpdate ? \"READY\" : \"NOT_READY\"}__`}\n >\n <LazyView shouldUpdate={shouldUpdate}>\n {children({ animationValue })}\n </LazyView>\n </Animated.View>\n );\n};\n"]}
1
+ {"version":3,"sources":["BaseLayout.tsx"],"names":["BaseLayout","props","mounted","handlerOffset","index","children","visibleRanges","animationStyle","context","React","useContext","CTX","loop","dataLength","width","height","vertical","customConfig","mode","modeConfig","size","shouldUpdate","setShouldUpdate","useState","offsetXConfig","snapDirection","showLength","type","viewCount","x","animationValue","value","animatedStyle","updateView","useCallback","negativeRange","positiveRange","current","position"],"mappings":"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","sourcesContent":["import React from \"react\";\nimport type { ViewStyle } from \"react-native\";\nimport type { AnimatedStyleProp } from \"react-native-reanimated\";\nimport Animated, {\n runOnJS,\n useAnimatedReaction,\n useAnimatedStyle,\n useDerivedValue,\n} from \"react-native-reanimated\";\n\nimport type { ILayoutConfig } from \"./stack\";\n\nimport { LazyView } from \"../components/LazyView\";\nimport { useCheckMounted } from \"../hooks/useCheckMounted\";\nimport type { IOpts } from \"../hooks/useOffsetX\";\nimport { useOffsetX } from \"../hooks/useOffsetX\";\nimport type { IVisibleRanges } from \"../hooks/useVisibleRanges\";\nimport { CTX } from \"../store\";\n\nexport type TAnimationStyle = (value: number) => AnimatedStyleProp<ViewStyle>;\n\nexport const BaseLayout: React.FC<{\n index: number\n handlerOffset: Animated.SharedValue<number>\n visibleRanges: IVisibleRanges\n animationStyle: TAnimationStyle\n children: (ctx: {\n animationValue: Animated.SharedValue<number>\n }) => React.ReactElement\n}> = (props) => {\n const mounted = useCheckMounted();\n const { handlerOffset, index, children, visibleRanges, animationStyle }\n = props;\n\n const context = React.useContext(CTX);\n const {\n props: {\n loop,\n dataLength,\n width,\n height,\n vertical,\n customConfig,\n mode,\n modeConfig,\n },\n } = context;\n const size = vertical ? height : width;\n const [shouldUpdate, setShouldUpdate] = React.useState(false);\n let offsetXConfig: IOpts = {\n handlerOffset,\n index,\n size,\n dataLength,\n loop,\n ...(typeof customConfig === \"function\" ? customConfig() : {}),\n };\n\n if (mode === \"horizontal-stack\") {\n const { snapDirection, showLength } = modeConfig as ILayoutConfig;\n\n offsetXConfig = {\n handlerOffset,\n index,\n size,\n dataLength,\n loop,\n type: snapDirection === \"right\" ? \"negative\" : \"positive\",\n viewCount: showLength,\n };\n }\n\n const x = useOffsetX(offsetXConfig, visibleRanges);\n const animationValue = useDerivedValue(() => x.value / size, [x, size]);\n const animatedStyle = useAnimatedStyle(\n () => animationStyle(x.value / size),\n [animationStyle],\n );\n\n const updateView = React.useCallback(\n (negativeRange: number[], positiveRange: number[]) => {\n mounted.current\n && setShouldUpdate(\n (index >= negativeRange[0] && index <= negativeRange[1])\n || (index >= positiveRange[0] && index <= positiveRange[1]),\n );\n },\n [index, mounted],\n );\n\n useAnimatedReaction(\n () => visibleRanges.value,\n () => {\n runOnJS(updateView)(\n visibleRanges.value.negativeRange,\n visibleRanges.value.positiveRange,\n );\n },\n [visibleRanges.value],\n );\n\n return (\n <Animated.View\n style={[\n {\n width: width || \"100%\",\n height: height || \"100%\",\n position: \"absolute\",\n },\n animatedStyle,\n ]}\n /**\n * We use this testID to know when the carousel item is ready to be tested in test.\n * e.g.\n * The testID of first item will be changed to __CAROUSEL_ITEM_0_READY__ from __CAROUSEL_ITEM_0_NOT_READY__ when the item is ready.\n * */\n testID={`__CAROUSEL_ITEM_${index}_${shouldUpdate ? \"READY\" : \"NOT_READY\"}__`}\n >\n <LazyView shouldUpdate={shouldUpdate}>\n {children({ animationValue })}\n </LazyView>\n </Animated.View>\n );\n};\n"]}