react-native-reanimated-carousel 5.0.0-beta.8 → 5.1.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 (402) hide show
  1. package/README.md +31 -29
  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/computed-with-auto-fill-data.js.map +1 -1
  51. package/lib/commonjs/utils/deal-with-animation.js +1 -1
  52. package/lib/commonjs/utils/deal-with-animation.js.map +1 -1
  53. package/lib/module/components/Carousel.js +1 -1
  54. package/lib/module/components/Carousel.js.map +1 -1
  55. package/lib/module/components/CarouselLayout.js +1 -1
  56. package/lib/module/components/CarouselLayout.js.map +1 -1
  57. package/lib/module/components/ItemLayout.js +1 -1
  58. package/lib/module/components/ItemLayout.js.map +1 -1
  59. package/lib/module/components/ItemRenderer.js +1 -1
  60. package/lib/module/components/ItemRenderer.js.map +1 -1
  61. package/lib/module/components/LazyView.js +1 -1
  62. package/lib/module/components/LazyView.js.map +1 -1
  63. package/lib/module/components/Pagination/PaginationItem.js +2 -0
  64. package/lib/module/components/Pagination/PaginationItem.js.map +1 -0
  65. package/lib/module/components/Pagination/index.js +1 -1
  66. package/lib/module/components/Pagination/index.js.map +1 -1
  67. package/lib/module/components/ScrollViewGesture.js +1 -1
  68. package/lib/module/components/ScrollViewGesture.js.map +1 -1
  69. package/lib/module/constants/index.js +1 -1
  70. package/lib/module/constants/index.js.map +1 -1
  71. package/lib/module/hooks/useAutoPlay.js +1 -1
  72. package/lib/module/hooks/useAutoPlay.js.map +1 -1
  73. package/lib/module/hooks/useCarouselController.js +1 -1
  74. package/lib/module/hooks/useCarouselController.js.map +1 -1
  75. package/lib/module/hooks/useCheckMounted.js +1 -1
  76. package/lib/module/hooks/useCheckMounted.js.map +1 -1
  77. package/lib/module/hooks/useCommonVariables.js +1 -1
  78. package/lib/module/hooks/useCommonVariables.js.map +1 -1
  79. package/lib/module/hooks/useInitProps.js +1 -1
  80. package/lib/module/hooks/useInitProps.js.map +1 -1
  81. package/lib/module/hooks/useLayoutConfig.js +1 -1
  82. package/lib/module/hooks/useLayoutConfig.js.map +1 -1
  83. package/lib/module/hooks/useOffsetX.js +1 -1
  84. package/lib/module/hooks/useOffsetX.js.map +1 -1
  85. package/lib/module/hooks/useOnProgressChange.js +1 -1
  86. package/lib/module/hooks/useOnProgressChange.js.map +1 -1
  87. package/lib/module/hooks/usePanGestureProxy.js +1 -1
  88. package/lib/module/hooks/usePanGestureProxy.js.map +1 -1
  89. package/lib/module/hooks/usePropsErrorBoundary.js +1 -1
  90. package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
  91. package/lib/module/hooks/useUpdateGestureConfig.js +1 -1
  92. package/lib/module/hooks/useUpdateGestureConfig.js.map +1 -1
  93. package/lib/module/hooks/useVisibleRanges.js +1 -1
  94. package/lib/module/hooks/useVisibleRanges.js.map +1 -1
  95. package/lib/module/index.js +1 -1
  96. package/lib/module/index.js.map +1 -1
  97. package/lib/module/layouts/index.js +1 -1
  98. package/lib/module/layouts/index.js.map +1 -1
  99. package/lib/module/layouts/normal.js +1 -1
  100. package/lib/module/layouts/normal.js.map +1 -1
  101. package/lib/module/layouts/parallax.js +1 -1
  102. package/lib/module/layouts/parallax.js.map +1 -1
  103. package/lib/module/layouts/stack.js +1 -1
  104. package/lib/module/layouts/stack.js.map +1 -1
  105. package/lib/module/package.json +1 -0
  106. package/lib/module/public-types.js +2 -0
  107. package/lib/module/public-types.js.map +1 -0
  108. package/lib/module/store/index.js +1 -1
  109. package/lib/module/store/index.js.map +1 -1
  110. package/lib/module/types.js +1 -1
  111. package/lib/module/utils/carousel-direction.js +2 -0
  112. package/lib/module/utils/carousel-direction.js.map +1 -0
  113. package/lib/module/utils/carousel-math.js +2 -0
  114. package/lib/module/utils/carousel-math.js.map +1 -0
  115. package/lib/module/utils/compute-gesture-translation.js +1 -1
  116. package/lib/module/utils/compute-gesture-translation.js.map +1 -1
  117. package/lib/module/utils/compute-offset-if-size-changed.js +1 -1
  118. package/lib/module/utils/compute-offset-if-size-changed.js.map +1 -1
  119. package/lib/module/utils/computed-with-auto-fill-data.js +1 -1
  120. package/lib/module/utils/computed-with-auto-fill-data.js.map +1 -1
  121. package/lib/module/utils/deal-with-animation.js +1 -1
  122. package/lib/module/utils/deal-with-animation.js.map +1 -1
  123. package/lib/module/utils/log.js +1 -1
  124. package/lib/module/utils/log.js.map +1 -1
  125. package/lib/module/utils/sanitize-animation-style.js +1 -1
  126. package/lib/module/utils/sanitize-animation-style.js.map +1 -1
  127. package/lib/typescript/commonjs/components/Carousel.d.ts +8 -0
  128. package/lib/typescript/commonjs/components/Carousel.d.ts.map +1 -0
  129. package/lib/typescript/{components → commonjs/components}/CarouselLayout.d.ts +5 -8
  130. package/lib/typescript/commonjs/components/CarouselLayout.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/components/ItemLayout.d.ts +21 -0
  132. package/lib/typescript/commonjs/components/ItemLayout.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/components/ItemRenderer.d.ts +24 -0
  134. package/lib/typescript/commonjs/components/ItemRenderer.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/components/LazyView.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts +14 -0
  137. package/lib/typescript/commonjs/components/Pagination/PaginationItem.d.ts.map +1 -0
  138. package/lib/typescript/commonjs/components/Pagination/index.d.ts +4 -0
  139. package/lib/typescript/commonjs/components/Pagination/index.d.ts.map +1 -0
  140. package/lib/typescript/{components → commonjs/components}/ScrollViewGesture.d.ts +3 -4
  141. package/lib/typescript/commonjs/components/ScrollViewGesture.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/constants/index.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts +12 -0
  144. package/lib/typescript/commonjs/hooks/useAutoPlay.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts +29 -0
  146. package/lib/typescript/commonjs/hooks/useCarouselController.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/hooks/useCheckMounted.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts +18 -0
  149. package/lib/typescript/commonjs/hooks/useCommonVariables.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/hooks/useInitProps.d.ts +25 -0
  151. package/lib/typescript/commonjs/hooks/useInitProps.d.ts.map +1 -0
  152. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts +8 -0
  153. package/lib/typescript/commonjs/hooks/useLayoutConfig.d.ts.map +1 -0
  154. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts +13 -0
  155. package/lib/typescript/commonjs/hooks/useOffsetX.d.ts.map +1 -0
  156. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts +12 -0
  157. package/lib/typescript/commonjs/hooks/useOnProgressChange.d.ts.map +1 -0
  158. package/lib/typescript/{hooks → commonjs/hooks}/usePanGestureProxy.d.ts +4 -3
  159. package/lib/typescript/commonjs/hooks/usePanGestureProxy.d.ts.map +1 -0
  160. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts +3 -0
  161. package/lib/typescript/commonjs/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  162. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts +9 -0
  163. package/lib/typescript/commonjs/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  164. package/lib/typescript/{hooks → commonjs/hooks}/useVisibleRanges.d.ts +6 -6
  165. package/lib/typescript/commonjs/hooks/useVisibleRanges.d.ts.map +1 -0
  166. package/lib/typescript/commonjs/index.d.ts +4 -0
  167. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  168. package/lib/typescript/{layouts → commonjs/layouts}/index.d.ts +0 -1
  169. package/lib/typescript/commonjs/layouts/index.d.ts.map +1 -0
  170. package/lib/typescript/commonjs/layouts/normal.d.ts +15 -0
  171. package/lib/typescript/commonjs/layouts/normal.d.ts.map +1 -0
  172. package/lib/typescript/commonjs/layouts/parallax.d.ts +27 -0
  173. package/lib/typescript/commonjs/layouts/parallax.d.ts.map +1 -0
  174. package/lib/typescript/commonjs/layouts/stack.d.ts +10 -0
  175. package/lib/typescript/commonjs/layouts/stack.d.ts.map +1 -0
  176. package/lib/typescript/commonjs/package.json +1 -0
  177. package/lib/typescript/commonjs/public-types.d.ts +171 -0
  178. package/lib/typescript/commonjs/public-types.d.ts.map +1 -0
  179. package/lib/typescript/{store → commonjs/store}/index.d.ts +8 -8
  180. package/lib/typescript/commonjs/store/index.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/types.d.ts +15 -0
  182. package/lib/typescript/commonjs/types.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/utils/carousel-direction.d.ts +9 -0
  184. package/lib/typescript/commonjs/utils/carousel-direction.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/utils/carousel-math.d.ts +28 -0
  186. package/lib/typescript/commonjs/utils/carousel-math.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/utils/compute-gesture-translation.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts +3 -0
  191. package/lib/typescript/commonjs/utils/deal-with-animation.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/utils/log.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/utils/sanitize-animation-style.d.ts.map +1 -0
  194. package/lib/typescript/module/components/Carousel.d.ts +8 -0
  195. package/lib/typescript/module/components/Carousel.d.ts.map +1 -0
  196. package/lib/typescript/module/components/CarouselLayout.d.ts +14 -0
  197. package/lib/typescript/module/components/CarouselLayout.d.ts.map +1 -0
  198. package/lib/typescript/module/components/ItemLayout.d.ts +21 -0
  199. package/lib/typescript/module/components/ItemLayout.d.ts.map +1 -0
  200. package/lib/typescript/module/components/ItemRenderer.d.ts +24 -0
  201. package/lib/typescript/module/components/ItemRenderer.d.ts.map +1 -0
  202. package/lib/typescript/module/components/LazyView.d.ts +8 -0
  203. package/lib/typescript/module/components/LazyView.d.ts.map +1 -0
  204. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts +14 -0
  205. package/lib/typescript/module/components/Pagination/PaginationItem.d.ts.map +1 -0
  206. package/lib/typescript/module/components/Pagination/index.d.ts +4 -0
  207. package/lib/typescript/module/components/Pagination/index.d.ts.map +1 -0
  208. package/lib/typescript/module/components/ScrollViewGesture.d.ts +18 -0
  209. package/lib/typescript/module/components/ScrollViewGesture.d.ts.map +1 -0
  210. package/lib/typescript/module/constants/index.d.ts +9 -0
  211. package/lib/typescript/module/constants/index.d.ts.map +1 -0
  212. package/lib/typescript/module/hooks/useAutoPlay.d.ts +12 -0
  213. package/lib/typescript/module/hooks/useAutoPlay.d.ts.map +1 -0
  214. package/lib/typescript/module/hooks/useCarouselController.d.ts +29 -0
  215. package/lib/typescript/module/hooks/useCarouselController.d.ts.map +1 -0
  216. package/lib/typescript/module/hooks/useCheckMounted.d.ts +3 -0
  217. package/lib/typescript/module/hooks/useCheckMounted.d.ts.map +1 -0
  218. package/lib/typescript/module/hooks/useCommonVariables.d.ts +18 -0
  219. package/lib/typescript/module/hooks/useCommonVariables.d.ts.map +1 -0
  220. package/lib/typescript/module/hooks/useInitProps.d.ts +25 -0
  221. package/lib/typescript/module/hooks/useInitProps.d.ts.map +1 -0
  222. package/lib/typescript/module/hooks/useLayoutConfig.d.ts +8 -0
  223. package/lib/typescript/module/hooks/useLayoutConfig.d.ts.map +1 -0
  224. package/lib/typescript/module/hooks/useOffsetX.d.ts +13 -0
  225. package/lib/typescript/module/hooks/useOffsetX.d.ts.map +1 -0
  226. package/lib/typescript/module/hooks/useOnProgressChange.d.ts +12 -0
  227. package/lib/typescript/module/hooks/useOnProgressChange.d.ts.map +1 -0
  228. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts +11 -0
  229. package/lib/typescript/module/hooks/usePanGestureProxy.d.ts.map +1 -0
  230. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts +3 -0
  231. package/lib/typescript/module/hooks/usePropsErrorBoundary.d.ts.map +1 -0
  232. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts +9 -0
  233. package/lib/typescript/module/hooks/useUpdateGestureConfig.d.ts.map +1 -0
  234. package/lib/typescript/module/hooks/useVisibleRanges.d.ts +22 -0
  235. package/lib/typescript/module/hooks/useVisibleRanges.d.ts.map +1 -0
  236. package/lib/typescript/module/index.d.ts +4 -0
  237. package/lib/typescript/module/index.d.ts.map +1 -0
  238. package/lib/typescript/module/layouts/index.d.ts +10 -0
  239. package/lib/typescript/module/layouts/index.d.ts.map +1 -0
  240. package/lib/typescript/module/layouts/normal.d.ts +15 -0
  241. package/lib/typescript/module/layouts/normal.d.ts.map +1 -0
  242. package/lib/typescript/module/layouts/parallax.d.ts +27 -0
  243. package/lib/typescript/module/layouts/parallax.d.ts.map +1 -0
  244. package/lib/typescript/module/layouts/stack.d.ts +10 -0
  245. package/lib/typescript/module/layouts/stack.d.ts.map +1 -0
  246. package/lib/typescript/module/package.json +1 -0
  247. package/lib/typescript/module/public-types.d.ts +171 -0
  248. package/lib/typescript/module/public-types.d.ts.map +1 -0
  249. package/lib/typescript/module/store/index.d.ts +35 -0
  250. package/lib/typescript/module/store/index.d.ts.map +1 -0
  251. package/lib/typescript/module/types.d.ts +15 -0
  252. package/lib/typescript/module/types.d.ts.map +1 -0
  253. package/lib/typescript/module/utils/carousel-direction.d.ts +9 -0
  254. package/lib/typescript/module/utils/carousel-direction.d.ts.map +1 -0
  255. package/lib/typescript/module/utils/carousel-math.d.ts +28 -0
  256. package/lib/typescript/module/utils/carousel-math.d.ts.map +1 -0
  257. package/lib/typescript/module/utils/compute-gesture-translation.d.ts +9 -0
  258. package/lib/typescript/module/utils/compute-gesture-translation.d.ts.map +1 -0
  259. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts +6 -0
  260. package/lib/typescript/module/utils/compute-offset-if-size-changed.d.ts.map +1 -0
  261. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts +23 -0
  262. package/lib/typescript/module/utils/computed-with-auto-fill-data.d.ts.map +1 -0
  263. package/lib/typescript/module/utils/deal-with-animation.d.ts +3 -0
  264. package/lib/typescript/module/utils/deal-with-animation.d.ts.map +1 -0
  265. package/lib/typescript/module/utils/log.d.ts +7 -0
  266. package/lib/typescript/module/utils/log.d.ts.map +1 -0
  267. package/lib/typescript/module/utils/sanitize-animation-style.d.ts +3 -0
  268. package/lib/typescript/module/utils/sanitize-animation-style.d.ts.map +1 -0
  269. package/package.json +31 -6
  270. package/scripts/codemods/v5.mjs +502 -0
  271. package/src/components/Carousel.tsx +5 -5
  272. package/src/components/CarouselLayout.tsx +52 -89
  273. package/src/components/ItemLayout.tsx +57 -48
  274. package/src/components/ItemRenderer.tsx +29 -18
  275. package/src/components/Pagination/PaginationItem.tsx +166 -0
  276. package/src/components/Pagination/index.tsx +105 -6
  277. package/src/components/ScrollViewGesture.tsx +92 -177
  278. package/src/hooks/useAutoPlay.ts +23 -18
  279. package/src/hooks/useCarouselController.tsx +196 -342
  280. package/src/hooks/useCommonVariables.ts +159 -71
  281. package/src/hooks/useInitProps.ts +161 -71
  282. package/src/hooks/useLayoutConfig.ts +21 -12
  283. package/src/hooks/useOffsetX.ts +6 -6
  284. package/src/hooks/useOnProgressChange.ts +23 -48
  285. package/src/hooks/usePanGestureProxy.ts +8 -8
  286. package/src/hooks/usePropsErrorBoundary.ts +32 -90
  287. package/src/hooks/useUpdateGestureConfig.ts +6 -3
  288. package/src/hooks/useVisibleRanges.tsx +6 -6
  289. package/src/index.tsx +14 -9
  290. package/src/layouts/index.tsx +0 -2
  291. package/src/layouts/normal.ts +14 -4
  292. package/src/layouts/parallax.ts +32 -59
  293. package/src/layouts/stack.ts +30 -70
  294. package/src/public-types.ts +209 -0
  295. package/src/store/index.tsx +7 -7
  296. package/src/types.ts +30 -322
  297. package/src/utils/carousel-direction.ts +39 -0
  298. package/src/utils/carousel-math.ts +156 -0
  299. package/src/utils/computed-with-auto-fill-data.ts +2 -2
  300. package/src/utils/deal-with-animation.ts +11 -9
  301. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js +0 -2
  302. package/lib/commonjs/components/Pagination/Basic/PaginationItem.js.map +0 -1
  303. package/lib/commonjs/components/Pagination/Basic/index.js +0 -2
  304. package/lib/commonjs/components/Pagination/Basic/index.js.map +0 -1
  305. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js +0 -2
  306. package/lib/commonjs/components/Pagination/Custom/PaginationItem.js.map +0 -1
  307. package/lib/commonjs/components/Pagination/Custom/index.js +0 -2
  308. package/lib/commonjs/components/Pagination/Custom/index.js.map +0 -1
  309. package/lib/commonjs/utils/compute-offset-if-data-changed.js +0 -2
  310. package/lib/commonjs/utils/compute-offset-if-data-changed.js.map +0 -1
  311. package/lib/commonjs/utils/handleroffset-direction.js +0 -2
  312. package/lib/commonjs/utils/handleroffset-direction.js.map +0 -1
  313. package/lib/module/components/Pagination/Basic/PaginationItem.js +0 -2
  314. package/lib/module/components/Pagination/Basic/PaginationItem.js.map +0 -1
  315. package/lib/module/components/Pagination/Basic/index.js +0 -2
  316. package/lib/module/components/Pagination/Basic/index.js.map +0 -1
  317. package/lib/module/components/Pagination/Custom/PaginationItem.js +0 -2
  318. package/lib/module/components/Pagination/Custom/PaginationItem.js.map +0 -1
  319. package/lib/module/components/Pagination/Custom/index.js +0 -2
  320. package/lib/module/components/Pagination/Custom/index.js.map +0 -1
  321. package/lib/module/utils/compute-offset-if-data-changed.js +0 -2
  322. package/lib/module/utils/compute-offset-if-data-changed.js.map +0 -1
  323. package/lib/module/utils/handleroffset-direction.js +0 -2
  324. package/lib/module/utils/handleroffset-direction.js.map +0 -1
  325. package/lib/typescript/components/Carousel.d.ts +0 -8
  326. package/lib/typescript/components/Carousel.d.ts.map +0 -1
  327. package/lib/typescript/components/CarouselLayout.d.ts.map +0 -1
  328. package/lib/typescript/components/ItemLayout.d.ts +0 -20
  329. package/lib/typescript/components/ItemLayout.d.ts.map +0 -1
  330. package/lib/typescript/components/ItemRenderer.d.ts +0 -23
  331. package/lib/typescript/components/ItemRenderer.d.ts.map +0 -1
  332. package/lib/typescript/components/LazyView.d.ts.map +0 -1
  333. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts +0 -29
  334. package/lib/typescript/components/Pagination/Basic/PaginationItem.d.ts.map +0 -1
  335. package/lib/typescript/components/Pagination/Basic/index.d.ts +0 -23
  336. package/lib/typescript/components/Pagination/Basic/index.d.ts.map +0 -1
  337. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts +0 -35
  338. package/lib/typescript/components/Pagination/Custom/PaginationItem.d.ts.map +0 -1
  339. package/lib/typescript/components/Pagination/Custom/index.d.ts +0 -26
  340. package/lib/typescript/components/Pagination/Custom/index.d.ts.map +0 -1
  341. package/lib/typescript/components/Pagination/index.d.ts +0 -5
  342. package/lib/typescript/components/Pagination/index.d.ts.map +0 -1
  343. package/lib/typescript/components/ScrollViewGesture.d.ts.map +0 -1
  344. package/lib/typescript/constants/index.d.ts.map +0 -1
  345. package/lib/typescript/hooks/useAutoPlay.d.ts +0 -12
  346. package/lib/typescript/hooks/useAutoPlay.d.ts.map +0 -1
  347. package/lib/typescript/hooks/useCarouselController.d.ts +0 -28
  348. package/lib/typescript/hooks/useCarouselController.d.ts.map +0 -1
  349. package/lib/typescript/hooks/useCheckMounted.d.ts.map +0 -1
  350. package/lib/typescript/hooks/useCommonVariables.d.ts +0 -13
  351. package/lib/typescript/hooks/useCommonVariables.d.ts.map +0 -1
  352. package/lib/typescript/hooks/useInitProps.d.ts +0 -10
  353. package/lib/typescript/hooks/useInitProps.d.ts.map +0 -1
  354. package/lib/typescript/hooks/useLayoutConfig.d.ts +0 -8
  355. package/lib/typescript/hooks/useLayoutConfig.d.ts.map +0 -1
  356. package/lib/typescript/hooks/useOffsetX.d.ts +0 -13
  357. package/lib/typescript/hooks/useOffsetX.d.ts.map +0 -1
  358. package/lib/typescript/hooks/useOnProgressChange.d.ts +0 -11
  359. package/lib/typescript/hooks/useOnProgressChange.d.ts.map +0 -1
  360. package/lib/typescript/hooks/usePanGestureProxy.d.ts.map +0 -1
  361. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts +0 -5
  362. package/lib/typescript/hooks/usePropsErrorBoundary.d.ts.map +0 -1
  363. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts +0 -6
  364. package/lib/typescript/hooks/useUpdateGestureConfig.d.ts.map +0 -1
  365. package/lib/typescript/hooks/useVisibleRanges.d.ts.map +0 -1
  366. package/lib/typescript/index.d.ts +0 -7
  367. package/lib/typescript/index.d.ts.map +0 -1
  368. package/lib/typescript/layouts/index.d.ts.map +0 -1
  369. package/lib/typescript/layouts/normal.d.ts +0 -13
  370. package/lib/typescript/layouts/normal.d.ts.map +0 -1
  371. package/lib/typescript/layouts/parallax.d.ts +0 -47
  372. package/lib/typescript/layouts/parallax.d.ts.map +0 -1
  373. package/lib/typescript/layouts/stack.d.ts +0 -38
  374. package/lib/typescript/layouts/stack.d.ts.map +0 -1
  375. package/lib/typescript/store/index.d.ts.map +0 -1
  376. package/lib/typescript/types.d.ts +0 -302
  377. package/lib/typescript/types.d.ts.map +0 -1
  378. package/lib/typescript/utils/compute-gesture-translation.d.ts.map +0 -1
  379. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts +0 -9
  380. package/lib/typescript/utils/compute-offset-if-data-changed.d.ts.map +0 -1
  381. package/lib/typescript/utils/compute-offset-if-size-changed.d.ts.map +0 -1
  382. package/lib/typescript/utils/computed-with-auto-fill-data.d.ts.map +0 -1
  383. package/lib/typescript/utils/deal-with-animation.d.ts +0 -3
  384. package/lib/typescript/utils/deal-with-animation.d.ts.map +0 -1
  385. package/lib/typescript/utils/handleroffset-direction.d.ts +0 -4
  386. package/lib/typescript/utils/handleroffset-direction.d.ts.map +0 -1
  387. package/lib/typescript/utils/log.d.ts.map +0 -1
  388. package/lib/typescript/utils/sanitize-animation-style.d.ts.map +0 -1
  389. package/src/components/Pagination/Basic/PaginationItem.tsx +0 -149
  390. package/src/components/Pagination/Basic/index.tsx +0 -98
  391. package/src/components/Pagination/Custom/PaginationItem.tsx +0 -166
  392. package/src/components/Pagination/Custom/index.tsx +0 -111
  393. package/src/utils/compute-offset-if-data-changed.ts +0 -44
  394. package/src/utils/handleroffset-direction.ts +0 -18
  395. /package/lib/typescript/{components → commonjs/components}/LazyView.d.ts +0 -0
  396. /package/lib/typescript/{constants → commonjs/constants}/index.d.ts +0 -0
  397. /package/lib/typescript/{hooks → commonjs/hooks}/useCheckMounted.d.ts +0 -0
  398. /package/lib/typescript/{utils → commonjs/utils}/compute-gesture-translation.d.ts +0 -0
  399. /package/lib/typescript/{utils → commonjs/utils}/compute-offset-if-size-changed.d.ts +0 -0
  400. /package/lib/typescript/{utils → commonjs/utils}/computed-with-auto-fill-data.d.ts +0 -0
  401. /package/lib/typescript/{utils → commonjs/utils}/log.d.ts +0 -0
  402. /package/lib/typescript/{utils → commonjs/utils}/sanitize-animation-style.d.ts +0 -0
@@ -0,0 +1,209 @@
1
+ import type * as React from "react";
2
+ import type { ColorValue, LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
3
+ import type {
4
+ GestureStateChangeEvent,
5
+ GestureType,
6
+ GestureUpdateEvent,
7
+ MouseButton,
8
+ PanGesture,
9
+ PanGestureChangeEventPayload,
10
+ PanGestureHandlerEventPayload,
11
+ PanGestureHandlerProps,
12
+ } from "react-native-gesture-handler";
13
+ import type { SharedValue, WithSpringConfig, WithTimingConfig } from "react-native-reanimated";
14
+
15
+ type CarouselOrientation = "horizontal" | "vertical";
16
+ type CarouselSnapMode = "page" | "nearest" | "none";
17
+ type CarouselAutoplayDirection = "forward" | "backward";
18
+ type CarouselExitDirection = "left" | "right";
19
+
20
+ type CarouselContentContainerStyle = Omit<ViewStyle, "opacity" | "transform">;
21
+
22
+ type CarouselExternalGestureRef =
23
+ | GestureType
24
+ | React.RefObject<GestureType | undefined>
25
+ | React.RefObject<React.ComponentType | undefined>;
26
+
27
+ type CarouselPanStateEvent = GestureStateChangeEvent<PanGestureHandlerEventPayload>;
28
+ type CarouselPanUpdateEvent = GestureUpdateEvent<PanGestureHandlerEventPayload>;
29
+ type CarouselPanChangeEvent = GestureUpdateEvent<
30
+ PanGestureHandlerEventPayload & PanGestureChangeEventPayload
31
+ >;
32
+
33
+ type CarouselLayoutSelection =
34
+ | {
35
+ layout?: CarouselLayout;
36
+ itemAnimation?: never;
37
+ }
38
+ | {
39
+ layout?: never;
40
+ itemAnimation: CarouselItemAnimation;
41
+ };
42
+
43
+ type InteractivePaginationProps = {
44
+ onPress: (index: number) => void;
45
+ getItemAccessibilityLabel?: (index: number, count: number) => string;
46
+ };
47
+
48
+ type DecorativePaginationProps = {
49
+ onPress?: never;
50
+ getItemAccessibilityLabel?: never;
51
+ };
52
+
53
+ type ReadonlyProgressValue = Omit<SharedValue<number>, "modify" | "set" | "value"> & {
54
+ readonly value: number;
55
+ };
56
+
57
+ type PaginationBaseProps = {
58
+ count: number;
59
+ progress: ReadonlyProgressValue;
60
+ orientation?: CarouselOrientation;
61
+ containerStyle?: StyleProp<Omit<ViewStyle, "direction" | "flexDirection">>;
62
+ dotStyle?: PaginationDotStyle;
63
+ activeDotStyle?: PaginationDotStyle;
64
+ };
65
+
66
+ export type CarouselProps<Item> = {
67
+ data: Item[];
68
+ renderItem: CarouselRenderItem<Item>;
69
+ keyExtractor?: (item: Item, index: number) => string;
70
+ defaultIndex?: number;
71
+ loop?: boolean;
72
+ autoplay?: boolean;
73
+ autoplayInterval?: number;
74
+ autoplayDirection?: CarouselAutoplayDirection;
75
+ orientation?: CarouselOrientation;
76
+ itemSize?: number;
77
+ scrollEnabled?: boolean;
78
+ snapMode?: CarouselSnapMode;
79
+ overscrollEnabled?: boolean;
80
+ renderWindowSize?: number;
81
+ animation?: CarouselAnimation;
82
+ progress?: SharedValue<number>;
83
+ onProgressChange?: CarouselProgressChangeHandler;
84
+ scrollOffsetValue?: SharedValue<number>;
85
+ style?: StyleProp<ViewStyle>;
86
+ contentContainerStyle?: StyleProp<CarouselContentContainerStyle>;
87
+ testID?: string;
88
+ onLayout?: (event: LayoutChangeEvent) => void;
89
+ onConfigurePanGesture?: (gesture: CarouselPanGesture) => void;
90
+ onScrollStart?: () => void;
91
+ onSnapToItem?: (index: number) => void;
92
+ } & CarouselLayoutSelection;
93
+
94
+ export interface CarouselRef {
95
+ prev(options?: CarouselStepOptions): void;
96
+ next(options?: CarouselStepOptions): void;
97
+ getCurrentIndex(): number;
98
+ scrollTo(options: CarouselScrollToOptions): void;
99
+ }
100
+
101
+ export type CarouselRenderItem<Item> = (info: CarouselRenderItemInfo<Item>) => React.ReactElement;
102
+
103
+ export interface CarouselRenderItemInfo<Item> {
104
+ item: Item;
105
+ index: number;
106
+ relativeProgress: SharedValue<number>;
107
+ }
108
+
109
+ export type CarouselProgressChangeHandler = (progress: number) => void;
110
+
111
+ export type CarouselLayout =
112
+ | {
113
+ type: "parallax";
114
+ offset?: number;
115
+ scale?: number;
116
+ adjacentScale?: number;
117
+ }
118
+ | {
119
+ type: "horizontal-stack";
120
+ visibleCount?: number;
121
+ exitDistance?: number;
122
+ spacing?: number;
123
+ scaleStep?: number;
124
+ opacityStep?: number;
125
+ rotation?: number;
126
+ exitDirection?: CarouselExitDirection;
127
+ }
128
+ | {
129
+ type: "vertical-stack";
130
+ visibleCount?: number;
131
+ exitDistance?: number;
132
+ spacing?: number;
133
+ scaleStep?: number;
134
+ opacityStep?: number;
135
+ rotation?: number;
136
+ exitDirection?: CarouselExitDirection;
137
+ };
138
+
139
+ export type CarouselAnimation =
140
+ | ({ type: "timing" } & WithTimingConfig)
141
+ | ({ type: "spring" } & WithSpringConfig);
142
+
143
+ export type CarouselItemAnimation = (relativeProgress: number, index: number) => ViewStyle;
144
+
145
+ /**
146
+ * Supported configuration surface for Carousel's real RNGH pan gesture.
147
+ *
148
+ * Methods return this facade so chaining never exposes ownership-changing RNGH
149
+ * methods such as `enabled`, `runOnJS`, or `manualActivation`.
150
+ */
151
+ export interface CarouselPanGesture {
152
+ /**
153
+ * Controlled view of the underlying RNGH pan gesture configuration.
154
+ *
155
+ * Exposes the web-only `touchAction` option (e.g. `"pan-y"` so a
156
+ * horizontal carousel nested in a vertically scrollable page keeps native
157
+ * vertical scrolling on mobile web) without casting away the facade.
158
+ * Ownership-changing options such as `enabled`, `runOnJS`, or
159
+ * `manualActivation` intentionally stay hidden.
160
+ */
161
+ readonly config: Pick<PanGesture["config"], "touchAction">;
162
+ activeOffsetX(offset: number | [start: number, end: number]): this;
163
+ activeOffsetY(offset: number | [start: number, end: number]): this;
164
+ failOffsetX(offset: number | [start: number, end: number]): this;
165
+ failOffsetY(offset: number | [start: number, end: number]): this;
166
+ minPointers(count: number): this;
167
+ maxPointers(count: number): this;
168
+ minDistance(distance: number): this;
169
+ minVelocity(velocity: number): this;
170
+ minVelocityX(velocity: number): this;
171
+ minVelocityY(velocity: number): this;
172
+ averageTouches(value: boolean): this;
173
+ enableTrackpadTwoFingerGesture(value: boolean): this;
174
+ activateAfterLongPress(duration: number): this;
175
+ hitSlop(value: PanGestureHandlerProps["hitSlop"]): this;
176
+ mouseButton(button: MouseButton): this;
177
+ simultaneousWithExternalGesture(...gestures: CarouselExternalGestureRef[]): this;
178
+ requireExternalGestureToFail(...gestures: CarouselExternalGestureRef[]): this;
179
+ blocksExternalGesture(...gestures: CarouselExternalGestureRef[]): this;
180
+ onBegin(callback: (event: CarouselPanStateEvent) => void): this;
181
+ onStart(callback: (event: CarouselPanStateEvent) => void): this;
182
+ onUpdate(callback: (event: CarouselPanUpdateEvent) => void): this;
183
+ onChange(callback: (event: CarouselPanChangeEvent) => void): this;
184
+ onEnd(callback: (event: CarouselPanStateEvent, success: boolean) => void): this;
185
+ onFinalize(callback: (event: CarouselPanStateEvent, success: boolean) => void): this;
186
+ }
187
+
188
+ export interface CarouselStepOptions {
189
+ count?: number;
190
+ animated?: boolean;
191
+ }
192
+
193
+ export interface CarouselScrollToOptions {
194
+ index: number;
195
+ animated?: boolean;
196
+ }
197
+
198
+ export type PaginationProps = PaginationBaseProps &
199
+ (InteractivePaginationProps | DecorativePaginationProps);
200
+
201
+ export interface PaginationDotStyle {
202
+ width?: number;
203
+ height?: number;
204
+ borderRadius?: number;
205
+ borderWidth?: number;
206
+ borderColor?: ColorValue;
207
+ backgroundColor?: ColorValue;
208
+ opacity?: number;
209
+ }
@@ -1,14 +1,14 @@
1
1
  import React from "react";
2
2
 
3
3
  import { SharedValue, useSharedValue } from "react-native-reanimated";
4
- import type { ICommonVariables } from "../hooks/useCommonVariables";
5
- import type { TInitializeCarouselProps } from "../hooks/useInitProps";
4
+ import type { CarouselCommonVariables } from "../hooks/useCommonVariables";
5
+ import type { InitializedCarouselProps } from "../hooks/useInitProps";
6
6
 
7
7
  type ItemDimensions = Record<number, { width: number; height: number }>;
8
8
 
9
- export interface IContext {
10
- props: TInitializeCarouselProps<any>;
11
- common: ICommonVariables;
9
+ export interface CarouselContext {
10
+ props: InitializedCarouselProps<unknown>;
11
+ common: CarouselCommonVariables;
12
12
  layout: {
13
13
  containerSize: SharedValue<{ width: number; height: number }>;
14
14
  updateContainerSize: (dimensions: { width: number; height: number }) => void;
@@ -17,14 +17,14 @@ export interface IContext {
17
17
  };
18
18
  }
19
19
 
20
- export const GlobalStateContext = React.createContext<IContext>({} as IContext);
20
+ export const GlobalStateContext = React.createContext<CarouselContext>({} as CarouselContext);
21
21
 
22
22
  export const GlobalStateProvider = ({
23
23
  children,
24
24
  value,
25
25
  }: {
26
26
  children: React.ReactNode;
27
- value: Pick<IContext, "props" | "common">;
27
+ value: Pick<CarouselContext, "props" | "common">;
28
28
  }) => {
29
29
  const containerSize = useSharedValue<{ width: number; height: number }>({ width: 0, height: 0 });
30
30
  const itemDimensions = useSharedValue<ItemDimensions>({});
package/src/types.ts CHANGED
@@ -1,324 +1,32 @@
1
- import type { LayoutChangeEvent, StyleProp, ViewStyle } from "react-native";
2
- import type { PanGesture } from "react-native-gesture-handler";
3
- import type { SharedValue, WithSpringConfig, WithTimingConfig } from "react-native-reanimated";
4
-
5
- import type { TParallaxModeProps } from "./layouts/parallax";
6
- import type { TStackModeProps } from "./layouts/stack";
7
-
8
- // biome-ignore lint/complexity/noBannedTypes: <explanation>
9
- export type IComputedDirectionTypes<T, VP = {}, HP = {}> =
10
- | (T &
11
- VP & {
12
- /**
13
- * Layout items vertically instead of horizontally
14
- */
15
- vertical: true;
16
- /**
17
- * Specified carousel container width.
18
- * @deprecated Use `style={{ width: ... }}` instead.
19
- */
20
- width?: number;
21
- /**
22
- * Specified carousel container height.
23
- * @deprecated Use `style={{ height: ... }}` instead.
24
- */
25
- height?: number;
26
- })
27
- | (T &
28
- HP & {
29
- /**
30
- * Layout items vertically instead of horizontally
31
- */
32
- vertical?: false;
33
- /**
34
- * Specified carousel container width.
35
- * @deprecated Use `style={{ width: ... }}` instead.
36
- */
37
- width?: number;
38
- /**
39
- * Specified carousel container height.
40
- * @deprecated Use `style={{ height: ... }}` instead.
41
- */
42
- height?: number;
43
- });
44
-
45
- export interface CustomConfig {
46
- type?: "negative" | "positive";
47
- viewCount?: number;
48
- }
49
-
50
- export interface WithSpringAnimation {
51
- type: "spring";
52
- config: WithSpringConfig;
53
- }
54
-
55
- export interface WithTimingAnimation {
56
- type: "timing";
57
- config: WithTimingConfig;
58
- }
59
-
60
- export type WithAnimation = WithSpringAnimation | WithTimingAnimation;
61
-
62
- export type TOnProgressChange =
63
- | ((offsetProgress: number, absoluteProgress: number) => void)
64
- /**
65
- * When a SharedValue is provided, the carousel will write `absoluteProgress` into it.
66
- */
67
- | SharedValue<number>;
68
-
69
- export type TCarouselProps<T = any> = {
70
- /**
71
- * @test_coverage ✅ tested in Carousel.test.tsx > should handle the ref props
72
- */
73
- ref?: React.Ref<ICarouselInstance>;
74
- /**
75
- * A shared value used internally as the carousel's translation (scroll offset) state.
76
- *
77
- * Prefer using `scrollOffsetValue` (same behavior, clearer name). This prop remains
78
- * for backwards compatibility.
79
- * @test_coverage ✅ tested in Carousel.test.tsx > should render the correct progress value with the defaultScrollOffsetValue props
80
- */
81
- /**
82
- * @deprecated Use `scrollOffsetValue` instead.
83
- */
84
- defaultScrollOffsetValue?: SharedValue<number>;
85
- /**
86
- * A shared value used internally as the carousel's translation (scroll offset) state.
87
- *
88
- * - If provided, the carousel will **mutate** it during gestures/animations.
89
- * - This is useful when you want to observe the scroll offset outside the carousel.
90
- */
91
- scrollOffsetValue?: SharedValue<number>;
92
- /**
93
- * Carousel loop playback.
94
- * @default true
95
- * @test_coverage ✅ tested in Carousel.test.tsx > should swipe back to the first item when loop is true
96
- */
97
- loop?: boolean;
98
- /**
99
- * Carousel items data set.
100
- * @test_coverage ✅ tested in Carousel.test.tsx > should render correctly
101
- */
102
- data: T[];
103
- /**
104
- * Auto fill data array to allow loop playback when the loop props is true.
105
- * @default true
106
- * @example
107
- * [1] => [1, 1, 1]
108
- * [1, 2] => [1, 2, 1, 2]
109
- * @test_coverage ✅ tested in Carousel.test.tsx > should auto fill data array to allow loop playback when the loop props is true
110
- */
111
- autoFillData?: boolean;
112
- /**
113
- * Default index
114
- * @default 0
115
- * @test_coverage ✅ tested in Carousel.test.tsx > should render the correct item with the defaultIndex props
116
- */
117
- defaultIndex?: number;
118
- /**
119
- * Auto play
120
- * @test_coverage ✅ tested in Carousel.test.tsx > should swipe automatically when autoPlay is true
121
- */
122
- autoPlay?: boolean;
123
- /**
124
- * Auto play
125
- * @description reverse playback
126
- * @test_coverage ✅ tested in Carousel.test.tsx > should swipe automatically in reverse when autoPlayReverse is true
127
- */
128
- autoPlayReverse?: boolean;
129
- /**
130
- * Auto play
131
- * @description playback interval
132
- */
133
- autoPlayInterval?: number;
134
- /**
135
- * Time a scroll animation takes to finish
136
- * @default 500 (ms)
137
- */
138
- scrollAnimationDuration?: number;
139
- /**
140
- * Carousel container style.
141
- */
142
- style?: StyleProp<ViewStyle>;
143
- /**
144
- * Carousel content container style.
145
- */
146
- contentContainerStyle?: StyleProp<ViewStyle>;
147
- /**
148
- * Horizontal **page size** used for snapping and animations.
149
- *
150
- * This is NOT the same as the container width:
151
- * - **Container size** comes from `style` (recommended) / deprecated `width` / layout measurement.
152
- * - **Page size** controls snap distance & animation progress per page.
153
- *
154
- * Use this when you want multiple items visible in a single viewport (page size < container width).
155
- * If not provided, the page size falls back to the carousel container width.
156
- */
157
- itemWidth?: number;
158
- /**
159
- * Vertical **page size** used for snapping and animations.
160
- *
161
- * See `itemWidth` for the container-size vs page-size distinction.
162
- * If not provided, the page size falls back to the carousel container height.
163
- */
164
- itemHeight?: number;
165
-
166
- // Other props...
167
-
168
- /**
169
- * @deprecated Previously controlled the outer container width (v4 behaviour).
170
- * Move this value into `style`, e.g. `style={{ width: 300 }}`.
171
- */
172
- width?: number;
173
- /**
174
- * @deprecated Previously controlled the outer container height (v4 behaviour).
175
- * Move this value into `style`, e.g. `style={{ height: 200 }}`.
176
- */
177
- height?: number;
178
- /**
179
- * PanGesture config
180
- * @test_coverage ✅ tested in Carousel.test.tsx > should call the onConfigurePanGesture callback
181
- */
182
- onConfigurePanGesture?: (panGesture: PanGesture) => void;
183
- /**
184
- * Determines the maximum number of items will respond to pan gesture events,
185
- * windowSize={11} will active visible item plus up to 5 items above and 5 below the viewpor,
186
- * Reducing this number will reduce the calculation of the animation value and may improve performance.
187
- * @default 0 all items will respond to pan gesture events.
188
- */
189
- windowSize?: number;
190
- /**
191
- * When true, the scroll view stops on multiples of the scroll view's size when scrolling.
192
- * @default true
193
- * @test_coverage ✅ tested in Carousel.test.tsx > should swipe to the next item when pagingEnabled is true
194
- */
195
- pagingEnabled?: boolean;
196
- /**
197
- * If enabled, releasing the touch will scroll to the nearest item.
198
- * valid when pagingEnabled=false
199
- * @default true
200
- */
201
- snapEnabled?: boolean;
202
- /**
203
- * If enabled, items will scroll to the first placement when scrolling past the edge rather than closing to the last. (previous conditions: loop=false)
204
- * @default true
205
- * @test_coverage ✅ tested in Carousel.test.tsx > should respect overscrollEnabled=false and prevent scrolling beyond bounds
206
- */
207
- overscrollEnabled?: boolean;
208
- /**
209
- * If false, Carousel will not respond to any gestures.
210
- * @default true
211
- */
212
- enabled?: boolean;
213
- /**
214
- * Specifies the scrolling animation effect.
215
- *
216
- * If provided, it takes precedence over `scrollAnimationDuration`.
217
- */
218
- withAnimation?: WithAnimation;
219
- /**
220
- * Used to locate this view in end-to-end tests.
221
- */
222
- testID?: string;
223
- /**
224
- * Maximum offset value for once scroll.
225
- * Carousel cannot scroll over than this value.
226
- * */
227
- maxScrollDistancePerSwipe?: number;
228
- /**
229
- * Minimum offset value for once scroll.
230
- * If the translation value is less than this value, the carousel will not scroll.
231
- * */
232
- minScrollDistancePerSwipe?: number;
233
- /**
234
- * @experimental This API will be changed in the future.
235
- * If positive, the carousel will scroll to the positive direction and vice versa.
236
- * @test_coverage ✅ tested in Carousel.test.tsx > should swipe to the correct direction when fixedDirection is positive
237
- * */
238
- fixedDirection?: "positive" | "negative";
239
- /**
240
- * Custom carousel config.
241
- */
242
- customConfig?: CustomConfig | (() => CustomConfig);
243
- /**
244
- * Custom animations.
245
- * Must be worklet-compatible. See https://docs.swmansion.com/react-native-reanimated/docs/guides/worklets/
246
- * @test_coverage ✅ tested in Carousel.test.tsx > should apply the custom animation
247
- */
248
- customAnimation?: (value: number, index: number) => ViewStyle;
249
- /**
250
- * Render carousel item.
251
- * @test_coverage ✅ tested in Carousel.test.tsx > should render items correctly
252
- */
253
- renderItem: CarouselRenderItem<T>;
254
- /**
255
- * Callback fired when navigating to an item.
256
- * @test_coverage ✅ tested in Carousel.test.tsx > should call the onSnapToItem callback
257
- */
258
- onSnapToItem?: (index: number) => void;
259
- /**
260
- * On scroll start
261
- * @test_coverage ✅ tested in Carousel.test.tsx > should call the onScrollStart callback
262
- */
263
- onScrollStart?: () => void;
264
- /**
265
- * On scroll end
266
- * @test_coverage ✅ tested in Carousel.test.tsx > should call the onScrollEnd callback
267
- */
268
- onScrollEnd?: (index: number) => void;
269
- /**
270
- * On progress change
271
- * @param offsetProgress Total of offset distance (0 390 780 ...)
272
- * @param absoluteProgress Convert to index (0 1 2 ...)
273
- * @test_coverage ✅ tested in Carousel.test.tsx > should call the onProgressChange callback
274
- *
275
- * If you want to update a shared value automatically, you can use the shared value as a parameter directly.
276
- */
277
- onProgressChange?: TOnProgressChange;
278
- onLayout?: (event: LayoutChangeEvent) => void;
279
-
280
- // ============================== deprecated props ==============================
281
- /**
282
- * If enabled, releasing the touch will scroll to the nearest item.
283
- * valid when pagingEnabled=false
284
- * @deprecated please use snapEnabled instead
285
- */
286
- enableSnap?: boolean;
287
- } & (TParallaxModeProps | TStackModeProps);
288
-
289
- export interface ICarouselInstance {
290
- /**
291
- * Scroll to previous item, it takes one optional argument (count),
292
- * which allows you to specify how many items to cross
293
- */
294
- prev: (opts?: Omit<TCarouselActionOptions, "index">) => void;
295
- /**
296
- * Scroll to next item, it takes one optional argument (count),
297
- * which allows you to specify how many items to cross
298
- */
299
- next: (opts?: Omit<TCarouselActionOptions, "index">) => void;
300
- /**
301
- * Get current item index
302
- */
303
- getCurrentIndex: () => number;
304
- /**
305
- * Use value to scroll to a position where relative to the current position,
306
- * scrollTo({count: -2}) is equivalent to prev(2), scrollTo({count: 2}) is equivalent to next(2)
307
- */
308
- scrollTo: (opts?: TCarouselActionOptions) => void;
309
- }
310
-
311
- export interface CarouselRenderItemInfo<ItemT> {
312
- item: ItemT;
313
- index: number;
314
- animationValue: SharedValue<number>;
315
- }
316
-
317
- export type CarouselRenderItem<ItemT> = (info: CarouselRenderItemInfo<ItemT>) => React.ReactElement;
1
+ import type { CarouselProps, CarouselScrollToOptions, CarouselStepOptions } from "./public-types";
2
+
3
+ export type {
4
+ CarouselAnimation,
5
+ CarouselItemAnimation,
6
+ CarouselLayout,
7
+ CarouselPanGesture,
8
+ CarouselProgressChangeHandler,
9
+ CarouselProps,
10
+ CarouselRef,
11
+ CarouselRenderItem,
12
+ CarouselRenderItemInfo,
13
+ CarouselScrollToOptions,
14
+ CarouselStepOptions,
15
+ PaginationDotStyle,
16
+ PaginationProps,
17
+ } from "./public-types";
18
+
19
+ /**
20
+ * Internal command options retain a completion hook so autoplay can schedule
21
+ * the next dwell period after a transition settles. This is never exported
22
+ * from the package root.
23
+ */
24
+ export type InternalCarouselStepOptions = CarouselStepOptions & {
25
+ onFinished?: () => void;
26
+ };
318
27
 
319
- export interface TCarouselActionOptions {
320
- index?: number;
321
- count?: number;
322
- animated?: boolean;
28
+ export type InternalCarouselScrollToOptions = CarouselScrollToOptions & {
323
29
  onFinished?: () => void;
324
- }
30
+ };
31
+
32
+ export type InternalCarouselProps<Item> = CarouselProps<Item>;
@@ -0,0 +1,39 @@
1
+ export type CarouselDirectionSign = -1 | 1;
2
+
3
+ export function getCarouselDirectionSign(options: {
4
+ isRTL: boolean;
5
+ orientation: "horizontal" | "vertical";
6
+ }): CarouselDirectionSign {
7
+ "worklet";
8
+
9
+ return options.orientation === "horizontal" && options.isRTL ? -1 : 1;
10
+ }
11
+
12
+ export function toLogicalGestureValue(
13
+ physicalValue: number,
14
+ directionSign: CarouselDirectionSign
15
+ ): number {
16
+ "worklet";
17
+
18
+ return physicalValue * directionSign;
19
+ }
20
+
21
+ export function toPhysicalHorizontalValue(
22
+ logicalValue: number,
23
+ directionSign: CarouselDirectionSign
24
+ ): number {
25
+ "worklet";
26
+
27
+ return logicalValue * directionSign;
28
+ }
29
+
30
+ export function getHorizontalStackOffsetType(
31
+ exitDirection: "left" | "right",
32
+ directionSign: CarouselDirectionSign
33
+ ): "positive" | "negative" {
34
+ "worklet";
35
+
36
+ const ltrType = exitDirection === "right" ? "negative" : "positive";
37
+ if (directionSign === 1) return ltrType;
38
+ return ltrType === "positive" ? "negative" : "positive";
39
+ }