react-native-reanimated-carousel 5.0.0-beta.7 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) hide show
  1. package/README.md +60 -28
  2. package/lib/commonjs/components/Carousel.js +1 -1
  3. package/lib/commonjs/components/Carousel.js.map +1 -1
  4. package/lib/commonjs/components/CarouselLayout.js +1 -1
  5. package/lib/commonjs/components/CarouselLayout.js.map +1 -1
  6. package/lib/commonjs/components/ItemLayout.js +1 -1
  7. package/lib/commonjs/components/ItemLayout.js.map +1 -1
  8. package/lib/commonjs/components/ItemRenderer.js +1 -1
  9. package/lib/commonjs/components/ItemRenderer.js.map +1 -1
  10. package/lib/commonjs/components/Pagination/PaginationItem.js +2 -0
  11. package/lib/commonjs/components/Pagination/PaginationItem.js.map +1 -0
  12. package/lib/commonjs/components/Pagination/index.js +1 -1
  13. package/lib/commonjs/components/Pagination/index.js.map +1 -1
  14. package/lib/commonjs/components/ScrollViewGesture.js +1 -1
  15. package/lib/commonjs/components/ScrollViewGesture.js.map +1 -1
  16. package/lib/commonjs/hooks/useAutoPlay.js +1 -1
  17. package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
  18. package/lib/commonjs/hooks/useCarouselController.js +1 -1
  19. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  20. package/lib/commonjs/hooks/useCommonVariables.js +1 -1
  21. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -1
  22. package/lib/commonjs/hooks/useInitProps.js +1 -1
  23. package/lib/commonjs/hooks/useInitProps.js.map +1 -1
  24. package/lib/commonjs/hooks/useLayoutConfig.js +1 -1
  25. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -1
  26. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  27. package/lib/commonjs/hooks/useOnProgressChange.js +1 -1
  28. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -1
  29. package/lib/commonjs/hooks/usePanGestureProxy.js.map +1 -1
  30. package/lib/commonjs/hooks/usePropsErrorBoundary.js +1 -1
  31. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  32. package/lib/commonjs/hooks/useUpdateGestureConfig.js.map +1 -1
  33. package/lib/commonjs/hooks/useVisibleRanges.js.map +1 -1
  34. package/lib/commonjs/index.js +1 -1
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/layouts/index.js.map +1 -1
  37. package/lib/commonjs/layouts/normal.js +1 -1
  38. package/lib/commonjs/layouts/normal.js.map +1 -1
  39. package/lib/commonjs/layouts/parallax.js +1 -1
  40. package/lib/commonjs/layouts/parallax.js.map +1 -1
  41. package/lib/commonjs/layouts/stack.js +1 -1
  42. package/lib/commonjs/layouts/stack.js.map +1 -1
  43. package/lib/commonjs/public-types.js +2 -0
  44. package/lib/commonjs/public-types.js.map +1 -0
  45. package/lib/commonjs/store/index.js.map +1 -1
  46. package/lib/commonjs/utils/carousel-direction.js +2 -0
  47. package/lib/commonjs/utils/carousel-direction.js.map +1 -0
  48. package/lib/commonjs/utils/carousel-math.js +2 -0
  49. package/lib/commonjs/utils/carousel-math.js.map +1 -0
  50. package/lib/commonjs/utils/deal-with-animation.js +1 -1
  51. package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
  52. package/lib/module/components/Carousel.js +1 -1
  53. package/lib/module/components/Carousel.js.map +1 -1
  54. package/lib/module/components/CarouselLayout.js +1 -1
  55. package/lib/module/components/CarouselLayout.js.map +1 -1
  56. package/lib/module/components/ItemLayout.js +1 -1
  57. package/lib/module/components/ItemLayout.js.map +1 -1
  58. package/lib/module/components/ItemRenderer.js +1 -1
  59. package/lib/module/components/ItemRenderer.js.map +1 -1
  60. package/lib/module/components/LazyView.js +1 -1
  61. package/lib/module/components/LazyView.js.map +1 -1
  62. package/lib/module/components/Pagination/PaginationItem.js +2 -0
  63. package/lib/module/components/Pagination/PaginationItem.js.map +1 -0
  64. package/lib/module/components/Pagination/index.js +1 -1
  65. package/lib/module/components/Pagination/index.js.map +1 -1
  66. package/lib/module/components/ScrollViewGesture.js +1 -1
  67. package/lib/module/components/ScrollViewGesture.js.map +1 -1
  68. package/lib/module/constants/index.js +1 -1
  69. package/lib/module/constants/index.js.map +1 -1
  70. package/lib/module/hooks/useAutoPlay.js +1 -1
  71. package/lib/module/hooks/useAutoPlay.js.map +1 -1
  72. package/lib/module/hooks/useCarouselController.js +1 -1
  73. package/lib/module/hooks/useCarouselController.js.map +1 -1
  74. package/lib/module/hooks/useCheckMounted.js +1 -1
  75. package/lib/module/hooks/useCheckMounted.js.map +1 -1
  76. package/lib/module/hooks/useCommonVariables.js +1 -1
  77. package/lib/module/hooks/useCommonVariables.js.map +1 -1
  78. package/lib/module/hooks/useInitProps.js +1 -1
  79. package/lib/module/hooks/useInitProps.js.map +1 -1
  80. package/lib/module/hooks/useLayoutConfig.js +1 -1
  81. package/lib/module/hooks/useLayoutConfig.js.map +1 -1
  82. package/lib/module/hooks/useOffsetX.js +1 -1
  83. package/lib/module/hooks/useOffsetX.js.map +1 -1
  84. package/lib/module/hooks/useOnProgressChange.js +1 -1
  85. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  86. package/lib/module/hooks/usePanGestureProxy.js +1 -1
  87. package/lib/module/hooks/usePanGestureProxy.js.map +1 -1
  88. package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
  89. package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
  90. package/lib/module/hooks/useUpdateGestureConfig.js +1 -1
  91. package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -1
  92. package/lib/module/hooks/useVisibleRanges.js +1 -1
  93. package/lib/module/hooks/useVisibleRanges.js.map +1 -1
  94. package/lib/module/index.js +1 -1
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/layouts/index.js +1 -1
  97. package/lib/module/layouts/index.js.map +1 -1
  98. package/lib/module/layouts/normal.js +1 -1
  99. package/lib/module/layouts/normal.js.map +1 -1
  100. package/lib/module/layouts/parallax.js +1 -1
  101. package/lib/module/layouts/parallax.js.map +1 -1
  102. package/lib/module/layouts/stack.js +1 -1
  103. package/lib/module/layouts/stack.js.map +1 -1
  104. package/lib/module/package.json +1 -0
  105. package/lib/module/public-types.js +2 -0
  106. package/lib/module/public-types.js.map +1 -0
  107. package/lib/module/store/index.js +1 -1
  108. package/lib/module/store/index.js.map +1 -1
  109. package/lib/module/types.js +1 -1
  110. package/lib/module/utils/carousel-direction.js +2 -0
  111. package/lib/module/utils/carousel-direction.js.map +1 -0
  112. package/lib/module/utils/carousel-math.js +2 -0
  113. package/lib/module/utils/carousel-math.js.map +1 -0
  114. package/lib/module/utils/compute-gesture-translation.js +1 -1
  115. package/lib/module/utils/compute-gesture-translation.js.map +1 -1
  116. package/lib/module/utils/compute-offset-if-size-changed.js +1 -1
  117. package/lib/module/utils/compute-offset-if-size-changed.js.map +1 -1
  118. package/lib/module/utils/computed-with-auto-fill-data.js +1 -1
  119. package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -1
  120. package/lib/module/utils/deal-with-animation.js +1 -1
  121. package/lib/module/utils/deal-with-animation.js.map +1 -1
  122. package/lib/module/utils/log.js +1 -1
  123. package/lib/module/utils/log.js.map +1 -1
  124. package/lib/module/utils/sanitize-animation-style.js +1 -1
  125. package/lib/module/utils/sanitize-animation-style.js.map +1 -1
  126. package/lib/typescript/commonjs/components/Carousel.d.ts +8 -0
  127. package/lib/typescript/commonjs/components/Carousel.d.ts.map +1 -0
  128. package/lib/typescript/{components → commonjs/components}/CarouselLayout.d.ts +5 -8
  129. package/lib/typescript/commonjs/components/CarouselLayout.d.ts.map +1 -0
  130. package/lib/typescript/{components → commonjs/components}/ItemLayout.d.ts +7 -6
  131. package/lib/typescript/commonjs/components/ItemLayout.d.ts.map +1 -0
  132. package/lib/typescript/commonjs/components/ItemRenderer.d.ts +24 -0
  133. package/lib/typescript/commonjs/components/ItemRenderer.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/components/LazyView.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts +14 -0
  136. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts.map +1 -0
  137. package/lib/typescript/commonjs/components/Pagination/index.d.ts +4 -0
  138. package/lib/typescript/commonjs/components/Pagination/index.d.ts.map +1 -0
  139. package/lib/typescript/{components → commonjs/components}/ScrollViewGesture.d.ts +3 -4
  140. package/lib/typescript/commonjs/components/ScrollViewGesture.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/constants/index.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts +12 -0
  143. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts +29 -0
  145. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/hooks/useCheckMounted.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts +18 -0
  148. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/hooks/useInitProps.d.ts +25 -0
  150. package/lib/typescript/commonjs/hooks/useInitProps.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts +8 -0
  152. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts +13 -0
  154. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts +12 -0
  156. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts.map +1 -0
  157. package/lib/typescript/{hooks → commonjs/hooks}/usePanGestureProxy.d.ts +3 -2
  158. package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts +3 -0
  160. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts +9 -0
  162. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  163. package/lib/typescript/{hooks → commonjs/hooks}/useVisibleRanges.d.ts +2 -2
  164. package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/index.d.ts +4 -0
  166. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  167. package/lib/typescript/{layouts → commonjs/layouts}/index.d.ts +0 -1
  168. package/lib/typescript/commonjs/layouts/index.d.ts.map +1 -0
  169. package/lib/typescript/{layouts → commonjs/layouts}/normal.d.ts +3 -1
  170. package/lib/typescript/commonjs/layouts/normal.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/layouts/parallax.d.ts +27 -0
  172. package/lib/typescript/commonjs/layouts/parallax.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/layouts/stack.d.ts +10 -0
  174. package/lib/typescript/commonjs/layouts/stack.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/package.json +1 -0
  176. package/lib/typescript/commonjs/public-types.d.ts +161 -0
  177. package/lib/typescript/commonjs/public-types.d.ts.map +1 -0
  178. package/lib/typescript/{store → commonjs/store}/index.d.ts +8 -8
  179. package/lib/typescript/commonjs/store/index.d.ts.map +1 -0
  180. package/lib/typescript/commonjs/types.d.ts +15 -0
  181. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/utils/carousel-direction.d.ts +9 -0
  183. package/lib/typescript/commonjs/utils/carousel-direction.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/utils/carousel-math.d.ts +28 -0
  185. package/lib/typescript/commonjs/utils/carousel-math.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/utils/compute-gesture-translation.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts +3 -0
  190. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/utils/log.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/utils/sanitize-animation-style.d.ts.map +1 -0
  193. package/lib/typescript/module/components/Carousel.d.ts +8 -0
  194. package/lib/typescript/module/components/Carousel.d.ts.map +1 -0
  195. package/lib/typescript/module/components/CarouselLayout.d.ts +14 -0
  196. package/lib/typescript/module/components/CarouselLayout.d.ts.map +1 -0
  197. package/lib/typescript/module/components/ItemLayout.d.ts +21 -0
  198. package/lib/typescript/module/components/ItemLayout.d.ts.map +1 -0
  199. package/lib/typescript/module/components/ItemRenderer.d.ts +24 -0
  200. package/lib/typescript/module/components/ItemRenderer.d.ts.map +1 -0
  201. package/lib/typescript/module/components/LazyView.d.ts +8 -0
  202. package/lib/typescript/module/components/LazyView.d.ts.map +1 -0
  203. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts +14 -0
  204. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts.map +1 -0
  205. package/lib/typescript/module/components/Pagination/index.d.ts +4 -0
  206. package/lib/typescript/module/components/Pagination/index.d.ts.map +1 -0
  207. package/lib/typescript/module/components/ScrollViewGesture.d.ts +18 -0
  208. package/lib/typescript/module/components/ScrollViewGesture.d.ts.map +1 -0
  209. package/lib/typescript/module/constants/index.d.ts +9 -0
  210. package/lib/typescript/module/constants/index.d.ts.map +1 -0
  211. package/lib/typescript/module/hooks/useAutoPlay.d.ts +12 -0
  212. package/lib/typescript/module/hooks/useAutoPlay.d.ts.map +1 -0
  213. package/lib/typescript/module/hooks/useCarouselController.d.ts +29 -0
  214. package/lib/typescript/module/hooks/useCarouselController.d.ts.map +1 -0
  215. package/lib/typescript/module/hooks/useCheckMounted.d.ts +3 -0
  216. package/lib/typescript/module/hooks/useCheckMounted.d.ts.map +1 -0
  217. package/lib/typescript/module/hooks/useCommonVariables.d.ts +18 -0
  218. package/lib/typescript/module/hooks/useCommonVariables.d.ts.map +1 -0
  219. package/lib/typescript/module/hooks/useInitProps.d.ts +25 -0
  220. package/lib/typescript/module/hooks/useInitProps.d.ts.map +1 -0
  221. package/lib/typescript/module/hooks/useLayoutConfig.d.ts +8 -0
  222. package/lib/typescript/module/hooks/useLayoutConfig.d.ts.map +1 -0
  223. package/lib/typescript/module/hooks/useOffsetX.d.ts +13 -0
  224. package/lib/typescript/module/hooks/useOffsetX.d.ts.map +1 -0
  225. package/lib/typescript/module/hooks/useOnProgressChange.d.ts +12 -0
  226. package/lib/typescript/module/hooks/useOnProgressChange.d.ts.map +1 -0
  227. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts +11 -0
  228. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts.map +1 -0
  229. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts +3 -0
  230. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  231. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts +9 -0
  232. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  233. package/lib/typescript/module/hooks/useVisibleRanges.d.ts +22 -0
  234. package/lib/typescript/module/hooks/useVisibleRanges.d.ts.map +1 -0
  235. package/lib/typescript/module/index.d.ts +4 -0
  236. package/lib/typescript/module/index.d.ts.map +1 -0
  237. package/lib/typescript/module/layouts/index.d.ts +10 -0
  238. package/lib/typescript/module/layouts/index.d.ts.map +1 -0
  239. package/lib/typescript/module/layouts/normal.d.ts +15 -0
  240. package/lib/typescript/module/layouts/normal.d.ts.map +1 -0
  241. package/lib/typescript/module/layouts/parallax.d.ts +27 -0
  242. package/lib/typescript/module/layouts/parallax.d.ts.map +1 -0
  243. package/lib/typescript/module/layouts/stack.d.ts +10 -0
  244. package/lib/typescript/module/layouts/stack.d.ts.map +1 -0
  245. package/lib/typescript/module/package.json +1 -0
  246. package/lib/typescript/module/public-types.d.ts +161 -0
  247. package/lib/typescript/module/public-types.d.ts.map +1 -0
  248. package/lib/typescript/module/store/index.d.ts +35 -0
  249. package/lib/typescript/module/store/index.d.ts.map +1 -0
  250. package/lib/typescript/module/types.d.ts +15 -0
  251. package/lib/typescript/module/types.d.ts.map +1 -0
  252. package/lib/typescript/module/utils/carousel-direction.d.ts +9 -0
  253. package/lib/typescript/module/utils/carousel-direction.d.ts.map +1 -0
  254. package/lib/typescript/module/utils/carousel-math.d.ts +28 -0
  255. package/lib/typescript/module/utils/carousel-math.d.ts.map +1 -0
  256. package/lib/typescript/module/utils/compute-gesture-translation.d.ts +9 -0
  257. package/lib/typescript/module/utils/compute-gesture-translation.d.ts.map +1 -0
  258. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts +6 -0
  259. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  260. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts +23 -0
  261. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  262. package/lib/typescript/module/utils/deal-with-animation.d.ts +3 -0
  263. package/lib/typescript/module/utils/deal-with-animation.d.ts.map +1 -0
  264. package/lib/typescript/module/utils/log.d.ts +7 -0
  265. package/lib/typescript/module/utils/log.d.ts.map +1 -0
  266. package/lib/typescript/module/utils/sanitize-animation-style.d.ts +3 -0
  267. package/lib/typescript/module/utils/sanitize-animation-style.d.ts.map +1 -0
  268. package/package.json +34 -7
  269. package/scripts/codemods/v5.mjs +502 -0
  270. package/src/components/Carousel.tsx +5 -5
  271. package/src/components/CarouselLayout.tsx +53 -91
  272. package/src/components/ItemLayout.tsx +55 -46
  273. package/src/components/ItemRenderer.tsx +29 -18
  274. package/src/components/Pagination/PaginationItem.tsx +162 -0
  275. package/src/components/Pagination/index.tsx +105 -6
  276. package/src/components/ScrollViewGesture.tsx +92 -177
  277. package/src/hooks/useAutoPlay.ts +23 -18
  278. package/src/hooks/useCarouselController.tsx +194 -340
  279. package/src/hooks/useCommonVariables.ts +159 -71
  280. package/src/hooks/useInitProps.ts +161 -71
  281. package/src/hooks/useLayoutConfig.ts +21 -12
  282. package/src/hooks/useOffsetX.ts +3 -3
  283. package/src/hooks/useOnProgressChange.ts +23 -48
  284. package/src/hooks/usePanGestureProxy.ts +2 -2
  285. package/src/hooks/usePropsErrorBoundary.ts +32 -90
  286. package/src/hooks/useUpdateGestureConfig.ts +5 -2
  287. package/src/hooks/useVisibleRanges.tsx +2 -2
  288. package/src/index.tsx +14 -9
  289. package/src/layouts/index.tsx +0 -2
  290. package/src/layouts/normal.ts +14 -4
  291. package/src/layouts/parallax.ts +32 -59
  292. package/src/layouts/stack.ts +30 -70
  293. package/src/public-types.ts +198 -0
  294. package/src/store/index.tsx +7 -7
  295. package/src/types.ts +30 -322
  296. package/src/utils/carousel-direction.ts +39 -0
  297. package/src/utils/carousel-math.ts +156 -0
  298. package/src/utils/deal-with-animation.ts +11 -9
  299. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +0 -2
  300. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +0 -1
  301. package/lib/commonjs/components/Pagination/Basic/index.js +0 -2
  302. package/lib/commonjs/components/Pagination/Basic/index.js.map +0 -1
  303. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +0 -2
  304. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +0 -1
  305. package/lib/commonjs/components/Pagination/Custom/index.js +0 -2
  306. package/lib/commonjs/components/Pagination/Custom/index.js.map +0 -1
  307. package/lib/commonjs/utils/compute-offset-if-data-changed.js +0 -2
  308. package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +0 -1
  309. package/lib/commonjs/utils/handleroffset-direction.js +0 -2
  310. package/lib/commonjs/utils/handleroffset-direction.js.map +0 -1
  311. package/lib/module/components/Pagination/Basic/PaginationItem.js +0 -2
  312. package/lib/module/components/Pagination/Basic/PaginationItem.js.map +0 -1
  313. package/lib/module/components/Pagination/Basic/index.js +0 -2
  314. package/lib/module/components/Pagination/Basic/index.js.map +0 -1
  315. package/lib/module/components/Pagination/Custom/PaginationItem.js +0 -2
  316. package/lib/module/components/Pagination/Custom/PaginationItem.js.map +0 -1
  317. package/lib/module/components/Pagination/Custom/index.js +0 -2
  318. package/lib/module/components/Pagination/Custom/index.js.map +0 -1
  319. package/lib/module/utils/compute-offset-if-data-changed.js +0 -2
  320. package/lib/module/utils/compute-offset-if-data-changed.js.map +0 -1
  321. package/lib/module/utils/handleroffset-direction.js +0 -2
  322. package/lib/module/utils/handleroffset-direction.js.map +0 -1
  323. package/lib/typescript/components/Carousel.d.ts +0 -8
  324. package/lib/typescript/components/Carousel.d.ts.map +0 -1
  325. package/lib/typescript/components/CarouselLayout.d.ts.map +0 -1
  326. package/lib/typescript/components/ItemLayout.d.ts.map +0 -1
  327. package/lib/typescript/components/ItemRenderer.d.ts +0 -23
  328. package/lib/typescript/components/ItemRenderer.d.ts.map +0 -1
  329. package/lib/typescript/components/LazyView.d.ts.map +0 -1
  330. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts +0 -29
  331. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts.map +0 -1
  332. package/lib/typescript/components/Pagination/Basic/index.d.ts +0 -23
  333. package/lib/typescript/components/Pagination/Basic/index.d.ts.map +0 -1
  334. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts +0 -35
  335. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts.map +0 -1
  336. package/lib/typescript/components/Pagination/Custom/index.d.ts +0 -26
  337. package/lib/typescript/components/Pagination/Custom/index.d.ts.map +0 -1
  338. package/lib/typescript/components/Pagination/index.d.ts +0 -5
  339. package/lib/typescript/components/Pagination/index.d.ts.map +0 -1
  340. package/lib/typescript/components/ScrollViewGesture.d.ts.map +0 -1
  341. package/lib/typescript/constants/index.d.ts.map +0 -1
  342. package/lib/typescript/hooks/useAutoPlay.d.ts +0 -12
  343. package/lib/typescript/hooks/useAutoPlay.d.ts.map +0 -1
  344. package/lib/typescript/hooks/useCarouselController.d.ts +0 -28
  345. package/lib/typescript/hooks/useCarouselController.d.ts.map +0 -1
  346. package/lib/typescript/hooks/useCheckMounted.d.ts.map +0 -1
  347. package/lib/typescript/hooks/useCommonVariables.d.ts +0 -13
  348. package/lib/typescript/hooks/useCommonVariables.d.ts.map +0 -1
  349. package/lib/typescript/hooks/useInitProps.d.ts +0 -10
  350. package/lib/typescript/hooks/useInitProps.d.ts.map +0 -1
  351. package/lib/typescript/hooks/useLayoutConfig.d.ts +0 -8
  352. package/lib/typescript/hooks/useLayoutConfig.d.ts.map +0 -1
  353. package/lib/typescript/hooks/useOffsetX.d.ts +0 -13
  354. package/lib/typescript/hooks/useOffsetX.d.ts.map +0 -1
  355. package/lib/typescript/hooks/useOnProgressChange.d.ts +0 -11
  356. package/lib/typescript/hooks/useOnProgressChange.d.ts.map +0 -1
  357. package/lib/typescript/hooks/usePanGestureProxy.d.ts.map +0 -1
  358. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +0 -5
  359. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts.map +0 -1
  360. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +0 -6
  361. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts.map +0 -1
  362. package/lib/typescript/hooks/useVisibleRanges.d.ts.map +0 -1
  363. package/lib/typescript/index.d.ts +0 -7
  364. package/lib/typescript/index.d.ts.map +0 -1
  365. package/lib/typescript/layouts/index.d.ts.map +0 -1
  366. package/lib/typescript/layouts/normal.d.ts.map +0 -1
  367. package/lib/typescript/layouts/parallax.d.ts +0 -47
  368. package/lib/typescript/layouts/parallax.d.ts.map +0 -1
  369. package/lib/typescript/layouts/stack.d.ts +0 -38
  370. package/lib/typescript/layouts/stack.d.ts.map +0 -1
  371. package/lib/typescript/store/index.d.ts.map +0 -1
  372. package/lib/typescript/types.d.ts +0 -302
  373. package/lib/typescript/types.d.ts.map +0 -1
  374. package/lib/typescript/utils/compute-gesture-translation.d.ts.map +0 -1
  375. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts +0 -9
  376. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts.map +0 -1
  377. package/lib/typescript/utils/compute-offset-if-size-changed.d.ts.map +0 -1
  378. package/lib/typescript/utils/computed-with-auto-fill-data.d.ts.map +0 -1
  379. package/lib/typescript/utils/deal-with-animation.d.ts +0 -3
  380. package/lib/typescript/utils/deal-with-animation.d.ts.map +0 -1
  381. package/lib/typescript/utils/handleroffset-direction.d.ts +0 -4
  382. package/lib/typescript/utils/handleroffset-direction.d.ts.map +0 -1
  383. package/lib/typescript/utils/log.d.ts.map +0 -1
  384. package/lib/typescript/utils/sanitize-animation-style.d.ts.map +0 -1
  385. package/src/components/Carousel.test.tsx +0 -1215
  386. package/src/components/LazyView.test.tsx +0 -61
  387. package/src/components/Pagination/Basic/PaginationItem.tsx +0 -149
  388. package/src/components/Pagination/Basic/index.tsx +0 -98
  389. package/src/components/Pagination/Custom/PaginationItem.tsx +0 -166
  390. package/src/components/Pagination/Custom/index.tsx +0 -111
  391. package/src/components/Pagination/Pagination.test.tsx +0 -178
  392. package/src/components/ScrollViewGesture.test.tsx +0 -155
  393. package/src/components/issue-899-parallax-reverse-loop.test.tsx +0 -131
  394. package/src/components/rnr-demo.test.tsx +0 -53
  395. package/src/hooks/useAutoPlay.test.ts +0 -194
  396. package/src/hooks/useCarouselController.test.tsx +0 -1158
  397. package/src/hooks/useCheckMounted.test.ts +0 -47
  398. package/src/hooks/useCommonVariables.test.tsx +0 -384
  399. package/src/hooks/useInitProps.test.tsx +0 -134
  400. package/src/hooks/useLayoutConfig.test.tsx +0 -247
  401. package/src/hooks/useOffsetX.test.ts +0 -54
  402. package/src/hooks/useOnProgressChange.test.tsx +0 -270
  403. package/src/hooks/usePanGestureProxy.test.tsx +0 -368
  404. package/src/hooks/usePropsErrorBoundary.test.tsx +0 -57
  405. package/src/hooks/useUpdateGestureConfig.test.ts +0 -89
  406. package/src/hooks/useVisibleRanges.test.tsx +0 -347
  407. package/src/layouts/parallax.test.ts +0 -239
  408. package/src/layouts/stack.test.ts +0 -252
  409. package/src/store/index.test.tsx +0 -314
  410. package/src/utils/compute-gesture-translation.test.ts +0 -70
  411. package/src/utils/compute-offset-if-data-changed.test.ts +0 -133
  412. package/src/utils/compute-offset-if-data-changed.ts +0 -44
  413. package/src/utils/compute-offset-if-size-changed.test.ts +0 -78
  414. package/src/utils/computed-with-auto-fill-data.test.ts +0 -298
  415. package/src/utils/deal-with-animation.test.ts +0 -181
  416. package/src/utils/handleroffset-direction.test.ts +0 -124
  417. package/src/utils/handleroffset-direction.ts +0 -18
  418. package/src/utils/index.test.ts +0 -90
  419. package/src/utils/log.test.ts +0 -134
  420. package/src/utils/sanitize-animation-style.test.ts +0 -40
  421. /package/lib/typescript/{components → commonjs/components}/LazyView.d.ts +0 -0
  422. /package/lib/typescript/{constants → commonjs/constants}/index.d.ts +0 -0
  423. /package/lib/typescript/{hooks → commonjs/hooks}/useCheckMounted.d.ts +0 -0
  424. /package/lib/typescript/{utils → commonjs/utils}/compute-gesture-translation.d.ts +0 -0
  425. /package/lib/typescript/{utils → commonjs/utils}/compute-offset-if-size-changed.d.ts +0 -0
  426. /package/lib/typescript/{utils → commonjs/utils}/computed-with-auto-fill-data.d.ts +0 -0
  427. /package/lib/typescript/{utils → commonjs/utils}/log.d.ts +0 -0
  428. /package/lib/typescript/{utils → commonjs/utils}/sanitize-animation-style.d.ts +0 -0
@@ -1,247 +0,0 @@
1
- import React from "react";
2
- import { View } from "react-native";
3
-
4
- import { renderHook } from "@testing-library/react-hooks";
5
-
6
- import { useLayoutConfig } from "./useLayoutConfig";
7
-
8
- describe("useLayoutConfig", () => {
9
- const defaultProps = {
10
- size: 300,
11
- vertical: false,
12
- };
13
- it("should return normal layout by default", () => {
14
- const { result } = renderHook(() =>
15
- useLayoutConfig({
16
- ...defaultProps,
17
- data: [],
18
- renderItem: () => <View />,
19
- loop: false,
20
- autoFillData: false,
21
- defaultIndex: 0,
22
- autoPlayInterval: 0,
23
- scrollAnimationDuration: 0,
24
- width: 0,
25
- height: 0,
26
- rawData: [],
27
- dataLength: 0,
28
- rawDataLength: 0,
29
- })
30
- );
31
-
32
- expect(result.current).toBeDefined();
33
- expect(typeof result.current).toBe("function");
34
- });
35
-
36
- it("should handle parallax mode", () => {
37
- const props = {
38
- ...defaultProps,
39
- mode: "parallax" as const,
40
- modeConfig: {
41
- parallaxScrollingScale: 0.9,
42
- parallaxScrollingOffset: 50,
43
- parallaxAdjacentItemScale: 0.8,
44
- },
45
- };
46
-
47
- const { result } = renderHook(() =>
48
- useLayoutConfig({
49
- ...props,
50
- data: [],
51
- renderItem: () => <View />,
52
- loop: false,
53
- autoFillData: false,
54
- defaultIndex: 0,
55
- autoPlayInterval: 0,
56
- scrollAnimationDuration: 0,
57
- width: 0,
58
- height: 0,
59
- rawData: [],
60
- dataLength: 0,
61
- rawDataLength: 0,
62
- })
63
- );
64
- const style = result.current(0); // Test with offset 0
65
-
66
- expect(style.transform).toBeDefined();
67
- expect(style.transform).toContainEqual({ translateX: 0 });
68
- expect(style.transform).toContainEqual({ scale: 0.9 });
69
- });
70
-
71
- it("should handle horizontal-stack mode", () => {
72
- const props = {
73
- ...defaultProps,
74
- mode: "horizontal-stack" as const,
75
- modeConfig: {
76
- snapDirection: "left" as const,
77
- showLength: 3,
78
- },
79
- };
80
-
81
- const { result } = renderHook(() =>
82
- useLayoutConfig({
83
- ...props,
84
- data: [],
85
- renderItem: () => <View />,
86
- loop: false,
87
- autoFillData: false,
88
- defaultIndex: 0,
89
- autoPlayInterval: 0,
90
- scrollAnimationDuration: 0,
91
- width: 0,
92
- height: 0,
93
- rawData: [],
94
- dataLength: 0,
95
- rawDataLength: 0,
96
- })
97
- );
98
- const style = result.current(0); // Test with offset 0
99
-
100
- expect(style.transform).toBeDefined();
101
- expect(style.zIndex).toBeDefined();
102
- expect(style.opacity).toBeDefined();
103
- });
104
-
105
- it("should handle vertical-stack mode", () => {
106
- const props = {
107
- ...defaultProps,
108
- mode: "vertical-stack" as const,
109
- modeConfig: {
110
- snapDirection: "left" as const,
111
- showLength: 3,
112
- },
113
- };
114
-
115
- const { result } = renderHook(() =>
116
- useLayoutConfig({
117
- ...props,
118
- data: [],
119
- renderItem: () => <View />,
120
- loop: false,
121
- autoFillData: false,
122
- defaultIndex: 0,
123
- autoPlayInterval: 0,
124
- scrollAnimationDuration: 0,
125
- width: 0,
126
- height: 0,
127
- rawData: [],
128
- dataLength: 0,
129
- rawDataLength: 0,
130
- })
131
- );
132
- const style = result.current(0); // Test with offset 0
133
-
134
- expect(style.transform).toBeDefined();
135
- expect(style.zIndex).toBeDefined();
136
- expect(style.opacity).toBeDefined();
137
- });
138
-
139
- it("should handle vertical orientation", () => {
140
- const props = {
141
- ...defaultProps,
142
- vertical: true,
143
- };
144
-
145
- const { result } = renderHook(() =>
146
- useLayoutConfig({
147
- ...props,
148
- data: [],
149
- renderItem: () => <View />,
150
- loop: false,
151
- autoFillData: false,
152
- defaultIndex: 0,
153
- autoPlayInterval: 0,
154
- scrollAnimationDuration: 0,
155
- width: 0,
156
- height: 0,
157
- rawData: [],
158
- dataLength: 0,
159
- rawDataLength: 0,
160
- })
161
- );
162
- const style = result.current(0); // Test with offset 0
163
-
164
- expect(style.transform).toBeDefined();
165
- expect(style.transform).toContainEqual({ translateY: 0 });
166
- });
167
-
168
- it("should handle different offsets", () => {
169
- const { result } = renderHook(() =>
170
- useLayoutConfig({
171
- ...defaultProps,
172
- data: [],
173
- renderItem: () => <View />,
174
- loop: false,
175
- autoFillData: false,
176
- defaultIndex: 0,
177
- autoPlayInterval: 0,
178
- scrollAnimationDuration: 0,
179
- width: 0,
180
- height: 0,
181
- rawData: [],
182
- dataLength: 0,
183
- rawDataLength: 0,
184
- })
185
- );
186
-
187
- const style1 = result.current(-1); // Previous item
188
- const style2 = result.current(0); // Current item
189
- const style3 = result.current(1); // Next item
190
-
191
- expect(style1.transform).toContainEqual({ translateX: -300 });
192
- expect(style2.transform).toContainEqual({ translateX: 0 });
193
- expect(style3.transform).toContainEqual({ translateX: 300 });
194
- });
195
-
196
- it("should memoize layout function", () => {
197
- const { result, rerender } = renderHook(() =>
198
- useLayoutConfig({
199
- ...defaultProps,
200
- data: [],
201
- renderItem: () => <View />,
202
- loop: false,
203
- autoFillData: false,
204
- defaultIndex: 0,
205
- autoPlayInterval: 0,
206
- scrollAnimationDuration: 0,
207
- width: 0,
208
- height: 0,
209
- rawData: [],
210
- dataLength: 0,
211
- rawDataLength: 0,
212
- })
213
- );
214
- const firstResult = result.current;
215
-
216
- rerender();
217
- expect(result.current).toBe(firstResult);
218
- });
219
-
220
- it("should update layout when props change", () => {
221
- const { result, rerender } = renderHook(
222
- (props) =>
223
- useLayoutConfig({
224
- ...props,
225
- data: [],
226
- renderItem: () => <View />,
227
- loop: false,
228
- autoFillData: false,
229
- defaultIndex: 0,
230
- autoPlayInterval: 0,
231
- scrollAnimationDuration: 0,
232
- width: 0,
233
- height: 0,
234
- rawData: [],
235
- dataLength: 0,
236
- rawDataLength: 0,
237
- }),
238
- {
239
- initialProps: defaultProps,
240
- }
241
- );
242
- const firstResult = result.current;
243
-
244
- rerender({ ...defaultProps, size: 400 });
245
- expect(result.current).not.toBe(firstResult);
246
- });
247
- });
@@ -1,54 +0,0 @@
1
- import { useSharedValue } from "react-native-reanimated";
2
-
3
- import { renderHook } from "@testing-library/react-hooks";
4
-
5
- import type { IOpts } from "./useOffsetX";
6
- import { useOffsetX } from "./useOffsetX";
7
- import type { IVisibleRanges } from "./useVisibleRanges";
8
-
9
- describe("useSharedValue", () => {
10
- it("should return the correct values", async () => {
11
- const hook = renderHook(() => {
12
- const range = useSharedValue({
13
- negativeRange: [7, 9],
14
- positiveRange: [0, 3],
15
- }) as IVisibleRanges;
16
- const inputs: Array<{
17
- config: IOpts;
18
- range: IVisibleRanges;
19
- }> = Array.from({ length: 10 }).map((_, index) => ({
20
- config: {
21
- dataLength: 10,
22
- handlerOffset: useSharedValue(-0),
23
- index,
24
- loop: false,
25
- size: 393,
26
- },
27
- range,
28
- }));
29
-
30
- return inputs.map((input) => {
31
- const { config, range } = input;
32
-
33
- return useOffsetX(config, range);
34
- });
35
- });
36
-
37
- const expected = hook.result.current.map((v) => v.value).slice();
38
-
39
- expect(expected).toMatchInlineSnapshot(`
40
- [
41
- 0,
42
- 393,
43
- 786,
44
- 1179,
45
- 9007199254740991,
46
- 9007199254740991,
47
- 9007199254740991,
48
- 2751,
49
- 3144,
50
- 3537,
51
- ]
52
- `);
53
- });
54
- });
@@ -1,270 +0,0 @@
1
- import { useSharedValue } from "react-native-reanimated";
2
-
3
- import { renderHook } from "@testing-library/react-hooks";
4
-
5
- import { useOnProgressChange } from "./useOnProgressChange";
6
-
7
- // Mock Reanimated and Easing
8
- jest.mock("react-native-reanimated", () => {
9
- const React = jest.requireActual("react");
10
- let reactionCallback: ((value: any) => void) | null = null;
11
- let reactionRegistrationCount = 0;
12
-
13
- return {
14
- useSharedValue: jest.fn((initialValue) => ({
15
- value: initialValue,
16
- })),
17
- useAnimatedReaction: jest.fn((prepare, react, dependencies) => {
18
- React.useEffect(() => {
19
- reactionRegistrationCount += 1;
20
- reactionCallback = react;
21
- react(prepare());
22
- return () => {
23
- if (reactionCallback === react) reactionCallback = null;
24
- };
25
- }, dependencies);
26
- }),
27
- Easing: {
28
- bezier: () => ({
29
- factory: () => 0,
30
- }),
31
- },
32
- // Export the helper function for testing
33
- __triggerReaction: (value: any) => {
34
- if (reactionCallback) reactionCallback(value);
35
- },
36
- __getReactionRegistrationCount: () => reactionRegistrationCount,
37
- __resetReactionRegistrationCount: () => {
38
- reactionRegistrationCount = 0;
39
- },
40
- };
41
- });
42
-
43
- jest.mock("react-native-worklets", () => {
44
- const mockScheduleOnRN = jest.fn((fn, ...args) => fn(...args));
45
- return {
46
- scheduleOnRN: mockScheduleOnRN,
47
- mockScheduleOnRN,
48
- };
49
- });
50
-
51
- // Mock computedOffsetXValueWithAutoFillData
52
- jest.mock("../utils/computed-with-auto-fill-data", () => ({
53
- computedOffsetXValueWithAutoFillData: jest.fn(({ value }) => value),
54
- }));
55
-
56
- describe("useOnProgressChange", () => {
57
- const mockOffsetX = useSharedValue(0);
58
- const mockSizeReady = useSharedValue(true);
59
- const mockOnProgressChange = jest.fn();
60
- const { __getReactionRegistrationCount, __resetReactionRegistrationCount, __triggerReaction } =
61
- jest.requireMock("react-native-reanimated");
62
-
63
- beforeEach(() => {
64
- jest.clearAllMocks();
65
- __resetReactionRegistrationCount();
66
- mockOffsetX.value = 0;
67
- mockSizeReady.value = true;
68
- });
69
-
70
- it("should handle progress change with function callback", () => {
71
- renderHook(() =>
72
- useOnProgressChange({
73
- size: 300,
74
- sizeReady: mockSizeReady,
75
- autoFillData: false,
76
- loop: false,
77
- offsetX: mockOffsetX,
78
- rawDataLength: 5,
79
- onProgressChange: mockOnProgressChange,
80
- })
81
- );
82
-
83
- mockOffsetX.value = -300; // Move to next slide
84
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
85
- expect(mockOnProgressChange).toHaveBeenCalledWith(-300, 1);
86
- });
87
-
88
- it("should handle progress change with shared value", () => {
89
- const progressValue = useSharedValue(0);
90
- renderHook(() =>
91
- useOnProgressChange({
92
- size: 300,
93
- sizeReady: mockSizeReady,
94
- autoFillData: false,
95
- loop: false,
96
- offsetX: mockOffsetX,
97
- rawDataLength: 5,
98
- onProgressChange: progressValue,
99
- })
100
- );
101
-
102
- mockOffsetX.value = -300; // Move to next slide
103
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
104
- expect(progressValue.value).toBe(1);
105
- });
106
-
107
- it("should handle loop mode", () => {
108
- renderHook(() =>
109
- useOnProgressChange({
110
- size: 300,
111
- sizeReady: mockSizeReady,
112
- autoFillData: false,
113
- loop: true,
114
- offsetX: mockOffsetX,
115
- rawDataLength: 5,
116
- onProgressChange: mockOnProgressChange,
117
- })
118
- );
119
-
120
- mockOffsetX.value = -1500; // Move to last slide
121
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
122
- expect(mockOnProgressChange).toHaveBeenCalledWith(-1500, 5);
123
- });
124
-
125
- it("should handle autoFillData mode", () => {
126
- renderHook(() =>
127
- useOnProgressChange({
128
- size: 300,
129
- sizeReady: mockSizeReady,
130
- autoFillData: true,
131
- loop: false,
132
- offsetX: mockOffsetX,
133
- rawDataLength: 3,
134
- onProgressChange: mockOnProgressChange,
135
- })
136
- );
137
-
138
- mockOffsetX.value = -300; // Move to next slide
139
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
140
- expect(mockOnProgressChange).toHaveBeenCalledWith(-300, 1);
141
- });
142
-
143
- it("should clamp values when not in loop mode", () => {
144
- renderHook(() =>
145
- useOnProgressChange({
146
- size: 300,
147
- sizeReady: mockSizeReady,
148
- autoFillData: false,
149
- loop: false,
150
- offsetX: mockOffsetX,
151
- rawDataLength: 3,
152
- onProgressChange: mockOnProgressChange,
153
- })
154
- );
155
-
156
- mockOffsetX.value = 300; // Try to move before first slide
157
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
158
- expect(mockOnProgressChange).toHaveBeenCalledWith(0, 0);
159
-
160
- mockOffsetX.value = -900; // Try to move after last slide
161
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
162
- expect(mockOnProgressChange).toHaveBeenCalledWith(-600, 2);
163
- });
164
-
165
- it("should handle positive offset values", () => {
166
- renderHook(() =>
167
- useOnProgressChange({
168
- size: 300,
169
- sizeReady: mockSizeReady,
170
- autoFillData: false,
171
- loop: true,
172
- offsetX: mockOffsetX,
173
- rawDataLength: 5,
174
- onProgressChange: mockOnProgressChange,
175
- })
176
- );
177
-
178
- mockOffsetX.value = 300; // Move backwards
179
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
180
- expect(mockOnProgressChange).toHaveBeenCalledWith(300, 4);
181
- });
182
-
183
- it("should not call onProgressChange if not provided", () => {
184
- renderHook(() =>
185
- useOnProgressChange({
186
- size: 300,
187
- sizeReady: mockSizeReady,
188
- autoFillData: false,
189
- loop: false,
190
- offsetX: mockOffsetX,
191
- rawDataLength: 5,
192
- })
193
- );
194
-
195
- mockOffsetX.value = -300; // Move to next slide
196
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeReady.value });
197
- // Should not throw any errors or call any callbacks
198
- });
199
-
200
- it("should not trigger progress change when size is not ready", () => {
201
- const mockSizeNotReady = useSharedValue(false);
202
- renderHook(() =>
203
- useOnProgressChange({
204
- size: 300,
205
- sizeReady: mockSizeNotReady,
206
- autoFillData: false,
207
- loop: false,
208
- offsetX: mockOffsetX,
209
- rawDataLength: 5,
210
- onProgressChange: mockOnProgressChange,
211
- })
212
- );
213
-
214
- mockOffsetX.value = -300; // Move to next slide
215
- __triggerReaction({ offset: mockOffsetX.value, ready: mockSizeNotReady.value });
216
- expect(mockOnProgressChange).not.toHaveBeenCalled();
217
- });
218
-
219
- it("should re-register the reaction when the offset shared value changes", () => {
220
- const replacementOffsetX = useSharedValue(-300);
221
- const { rerender } = renderHook(
222
- ({ offsetX }) =>
223
- useOnProgressChange({
224
- size: 300,
225
- sizeReady: mockSizeReady,
226
- autoFillData: false,
227
- loop: false,
228
- offsetX,
229
- rawDataLength: 5,
230
- onProgressChange: mockOnProgressChange,
231
- }),
232
- { initialProps: { offsetX: mockOffsetX } }
233
- );
234
-
235
- const initialRegistrationCount = __getReactionRegistrationCount();
236
- rerender({ offsetX: mockOffsetX });
237
- expect(__getReactionRegistrationCount()).toBe(initialRegistrationCount);
238
-
239
- rerender({ offsetX: replacementOffsetX });
240
-
241
- expect(__getReactionRegistrationCount()).toBe(initialRegistrationCount + 1);
242
- expect(mockOnProgressChange).toHaveBeenLastCalledWith(-300, 1);
243
- });
244
-
245
- it("should re-register the reaction when the size-ready shared value changes", () => {
246
- const initialSizeReady = useSharedValue(false);
247
- const replacementSizeReady = useSharedValue(true);
248
- const { rerender } = renderHook(
249
- ({ sizeReady }) =>
250
- useOnProgressChange({
251
- size: 300,
252
- sizeReady,
253
- autoFillData: false,
254
- loop: false,
255
- offsetX: mockOffsetX,
256
- rawDataLength: 5,
257
- onProgressChange: mockOnProgressChange,
258
- }),
259
- { initialProps: { sizeReady: initialSizeReady } }
260
- );
261
-
262
- const initialRegistrationCount = __getReactionRegistrationCount();
263
- expect(mockOnProgressChange).not.toHaveBeenCalled();
264
-
265
- rerender({ sizeReady: replacementSizeReady });
266
-
267
- expect(__getReactionRegistrationCount()).toBe(initialRegistrationCount + 1);
268
- expect(mockOnProgressChange).toHaveBeenCalledWith(0, 0);
269
- });
270
- });