react-native-system-ui 0.0.4 → 0.0.6

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 (371) hide show
  1. package/dist/cjs/components/action-sheet/ActionSheet.js +28 -22
  2. package/dist/cjs/components/area/Area.js +72 -6
  3. package/dist/cjs/components/area/tokens.js +11 -0
  4. package/dist/cjs/components/avatar/Avatar.js +42 -10
  5. package/dist/cjs/components/badge/Badge.js +10 -10
  6. package/dist/cjs/components/badge/tokens.js +4 -0
  7. package/dist/cjs/components/button/Button.js +16 -65
  8. package/dist/cjs/components/button/ButtonContext.js +7 -10
  9. package/dist/cjs/components/button/ButtonGroup.js +13 -15
  10. package/dist/cjs/components/button/tokens.js +1 -5
  11. package/dist/cjs/components/calendar/Calendar.js +23 -12
  12. package/dist/cjs/components/cascader/Cascader.js +18 -13
  13. package/dist/cjs/components/cell/Cell.js +3 -3
  14. package/dist/cjs/components/cell/CellGroup.js +26 -21
  15. package/dist/cjs/components/checkbox/Checkbox.js +5 -4
  16. package/dist/cjs/components/checkbox/CheckboxContext.js +7 -10
  17. package/dist/cjs/components/checkbox/CheckboxGroup.js +24 -21
  18. package/dist/cjs/components/circle/Circle.js +6 -6
  19. package/dist/cjs/components/collapse/Collapse.js +10 -10
  20. package/dist/cjs/components/config-provider/locale/en-US.js +66 -4
  21. package/dist/cjs/components/config-provider/locale/zh-CN.js +74 -2
  22. package/dist/cjs/components/config-provider/tokens.js +11 -0
  23. package/dist/cjs/components/count-down/CountDown.js +6 -6
  24. package/dist/cjs/components/datetime-picker/DatetimePicker.js +6 -6
  25. package/dist/cjs/components/datetime-picker/tokens.js +11 -0
  26. package/dist/cjs/components/dialog/Dialog.js +39 -34
  27. package/dist/cjs/components/dialog/tokens.js +1 -4
  28. package/dist/cjs/components/divider/Divider.js +36 -1
  29. package/dist/cjs/components/field/Field.js +303 -201
  30. package/dist/cjs/components/flex/Flex.js +7 -3
  31. package/dist/cjs/components/flex/FlexContext.js +7 -14
  32. package/dist/cjs/components/form/Form.js +112 -122
  33. package/dist/cjs/components/form/FormContext.js +7 -10
  34. package/dist/cjs/components/form/FormItem.js +30 -4
  35. package/dist/cjs/components/form/FormList.js +16 -3
  36. package/dist/cjs/components/form/tokens.js +11 -0
  37. package/dist/cjs/components/form/utils.js +2 -1
  38. package/dist/cjs/components/grid/Grid.js +45 -31
  39. package/dist/cjs/components/grid/GridContext.js +7 -10
  40. package/dist/cjs/components/grid/GridItem.js +22 -22
  41. package/dist/cjs/components/image/Image.js +17 -13
  42. package/dist/cjs/components/image-preview/ImagePreview.js +43 -41
  43. package/dist/cjs/components/index.js +43 -141
  44. package/dist/cjs/components/input/Input.js +19 -5
  45. package/dist/cjs/components/loading/Loading.js +10 -139
  46. package/dist/cjs/components/loading/tokens.js +0 -24
  47. package/dist/cjs/components/notice-bar/NoticeBar.js +45 -41
  48. package/dist/cjs/components/notify/Notify.js +72 -30
  49. package/dist/cjs/components/notify/imperative.js +2 -2
  50. package/dist/cjs/components/notify/tokens.js +11 -1
  51. package/dist/cjs/components/number-keyboard/NumberKeyboard.js +6 -6
  52. package/dist/cjs/components/overlay/Overlay.js +70 -77
  53. package/dist/cjs/components/overlay/index.js +13 -27
  54. package/dist/cjs/components/overlay/tokens.js +4 -31
  55. package/dist/cjs/components/password-input/PasswordInput.js +2 -41
  56. package/dist/cjs/components/password-input/tokens.js +53 -0
  57. package/dist/cjs/components/picker/Picker.js +618 -38
  58. package/dist/cjs/components/popup/Popup.js +60 -47
  59. package/dist/cjs/components/portal/Portal.js +39 -31
  60. package/dist/cjs/components/portal/PortalHost.js +258 -213
  61. package/dist/cjs/components/portal/tokens.js +11 -0
  62. package/dist/cjs/components/progress/Progress.js +77 -36
  63. package/dist/cjs/components/progress/index.js +6 -0
  64. package/dist/cjs/components/radio/Radio.js +35 -12
  65. package/dist/cjs/components/radio/RadioContext.js +7 -10
  66. package/dist/cjs/components/radio/RadioGroup.js +23 -20
  67. package/dist/cjs/components/safe-area-view/tokens.js +11 -0
  68. package/dist/cjs/components/search/Search.js +16 -16
  69. package/dist/cjs/components/selector/Selector.js +6 -6
  70. package/dist/cjs/components/share-sheet/ShareSheet.js +50 -46
  71. package/dist/cjs/components/sidebar/Sidebar.js +27 -22
  72. package/dist/cjs/components/sidebar/SidebarItem.js +27 -22
  73. package/dist/cjs/components/skeleton/Skeleton.js +34 -21
  74. package/dist/cjs/components/slider/Slider.js +135 -78
  75. package/dist/cjs/components/stepper/Stepper.js +12 -10
  76. package/dist/cjs/components/swiper/Swiper.js +247 -710
  77. package/dist/cjs/components/swiper/SwiperItem.js +5 -33
  78. package/dist/cjs/components/swiper/tokens.js +11 -0
  79. package/dist/cjs/components/switch/Switch.js +46 -98
  80. package/dist/cjs/components/switch/tokens.js +1 -55
  81. package/dist/cjs/components/tabbar/Tabbar.js +26 -22
  82. package/dist/cjs/components/tabbar/TabbarItem.js +23 -22
  83. package/dist/cjs/components/tabbar/tokens.js +0 -2
  84. package/dist/cjs/components/tabs/Tabs.js +268 -94
  85. package/dist/cjs/components/tabs/index.js +4 -5
  86. package/dist/cjs/components/toast/Toast.js +72 -27
  87. package/dist/cjs/components/toast/imperative.js +2 -2
  88. package/dist/cjs/hooks/gesture/useGestureScroll.js +1 -2
  89. package/dist/cjs/hooks/index.js +12 -12
  90. package/dist/cjs/hooks/overlay/index.js +27 -0
  91. package/dist/cjs/hooks/useHairline.js +0 -4
  92. package/dist/cjs/platform/scrollLock.js +1 -1
  93. package/dist/cjs/utils/compare.js +26 -0
  94. package/dist/cjs/utils/index.js +11 -0
  95. package/dist/es/components/action-sheet/ActionSheet.js +29 -23
  96. package/dist/es/components/area/Area.js +73 -7
  97. package/dist/es/components/area/tokens.js +5 -0
  98. package/dist/es/components/avatar/Avatar.js +42 -10
  99. package/dist/es/components/badge/Badge.js +11 -11
  100. package/dist/es/components/badge/tokens.js +4 -0
  101. package/dist/es/components/button/Button.js +17 -65
  102. package/dist/es/components/button/ButtonContext.js +1 -2
  103. package/dist/es/components/button/ButtonGroup.js +10 -12
  104. package/dist/es/components/button/tokens.js +1 -5
  105. package/dist/es/components/calendar/Calendar.js +24 -13
  106. package/dist/es/components/cascader/Cascader.js +16 -11
  107. package/dist/es/components/cell/Cell.js +4 -4
  108. package/dist/es/components/cell/CellGroup.js +25 -20
  109. package/dist/es/components/checkbox/Checkbox.js +5 -4
  110. package/dist/es/components/checkbox/CheckboxContext.js +1 -2
  111. package/dist/es/components/checkbox/CheckboxGroup.js +24 -21
  112. package/dist/es/components/circle/Circle.js +7 -7
  113. package/dist/es/components/collapse/Collapse.js +11 -11
  114. package/dist/es/components/config-provider/locale/en-US.js +66 -4
  115. package/dist/es/components/config-provider/locale/zh-CN.js +74 -2
  116. package/dist/es/components/config-provider/tokens.js +5 -0
  117. package/dist/es/components/count-down/CountDown.js +7 -7
  118. package/dist/es/components/datetime-picker/DatetimePicker.js +7 -7
  119. package/dist/es/components/datetime-picker/tokens.js +5 -0
  120. package/dist/es/components/dialog/Dialog.js +40 -35
  121. package/dist/es/components/dialog/tokens.js +1 -4
  122. package/dist/es/components/divider/Divider.js +36 -1
  123. package/dist/es/components/field/Field.js +304 -202
  124. package/dist/es/components/flex/Flex.js +5 -1
  125. package/dist/es/components/flex/FlexContext.js +1 -6
  126. package/dist/es/components/form/Form.js +89 -99
  127. package/dist/es/components/form/FormContext.js +1 -2
  128. package/dist/es/components/form/FormItem.js +32 -6
  129. package/dist/es/components/form/FormList.js +18 -5
  130. package/dist/es/components/form/tokens.js +5 -0
  131. package/dist/es/components/form/utils.js +1 -0
  132. package/dist/es/components/grid/Grid.js +43 -29
  133. package/dist/es/components/grid/GridContext.js +1 -2
  134. package/dist/es/components/grid/GridItem.js +24 -24
  135. package/dist/es/components/image/Image.js +18 -14
  136. package/dist/es/components/image-preview/ImagePreview.js +44 -42
  137. package/dist/es/components/index.js +2 -17
  138. package/dist/es/components/input/Input.js +20 -6
  139. package/dist/es/components/loading/Loading.js +10 -139
  140. package/dist/es/components/loading/tokens.js +0 -24
  141. package/dist/es/components/notice-bar/NoticeBar.js +46 -42
  142. package/dist/es/components/notify/Notify.js +72 -30
  143. package/dist/es/components/notify/imperative.js +2 -2
  144. package/dist/es/components/notify/tokens.js +5 -1
  145. package/dist/es/components/number-keyboard/NumberKeyboard.js +7 -7
  146. package/dist/es/components/overlay/Overlay.js +58 -75
  147. package/dist/es/components/overlay/index.js +3 -4
  148. package/dist/es/components/overlay/tokens.js +3 -29
  149. package/dist/es/components/password-input/PasswordInput.js +1 -40
  150. package/dist/es/components/password-input/tokens.js +41 -0
  151. package/dist/es/components/picker/Picker.js +610 -34
  152. package/dist/es/components/popup/Popup.js +62 -49
  153. package/dist/es/components/portal/Portal.js +37 -31
  154. package/dist/es/components/portal/PortalHost.js +257 -211
  155. package/dist/es/components/portal/tokens.js +5 -0
  156. package/dist/es/components/progress/Progress.js +76 -36
  157. package/dist/es/components/progress/index.js +2 -1
  158. package/dist/es/components/radio/Radio.js +37 -14
  159. package/dist/es/components/radio/RadioContext.js +1 -2
  160. package/dist/es/components/radio/RadioGroup.js +23 -20
  161. package/dist/es/components/safe-area-view/tokens.js +5 -0
  162. package/dist/es/components/search/Search.js +17 -17
  163. package/dist/es/components/selector/Selector.js +7 -7
  164. package/dist/es/components/share-sheet/ShareSheet.js +51 -47
  165. package/dist/es/components/sidebar/Sidebar.js +26 -21
  166. package/dist/es/components/sidebar/SidebarItem.js +26 -22
  167. package/dist/es/components/skeleton/Skeleton.js +35 -22
  168. package/dist/es/components/slider/Slider.js +132 -75
  169. package/dist/es/components/stepper/Stepper.js +13 -11
  170. package/dist/es/components/swiper/Swiper.js +248 -711
  171. package/dist/es/components/swiper/SwiperItem.js +1 -21
  172. package/dist/es/components/swiper/tokens.js +5 -0
  173. package/dist/es/components/switch/Switch.js +49 -101
  174. package/dist/es/components/switch/tokens.js +1 -49
  175. package/dist/es/components/tabbar/Tabbar.js +27 -23
  176. package/dist/es/components/tabbar/TabbarItem.js +22 -22
  177. package/dist/es/components/tabbar/tokens.js +0 -2
  178. package/dist/es/components/tabs/Tabs.js +264 -90
  179. package/dist/es/components/tabs/index.js +1 -2
  180. package/dist/es/components/toast/Toast.js +72 -28
  181. package/dist/es/components/toast/imperative.js +2 -2
  182. package/dist/es/hooks/gesture/useGestureScroll.js +1 -2
  183. package/dist/es/hooks/index.js +1 -1
  184. package/dist/es/hooks/overlay/index.js +3 -0
  185. package/dist/es/hooks/useHairline.js +0 -4
  186. package/dist/es/platform/scrollLock.js +1 -1
  187. package/dist/es/utils/compare.js +18 -0
  188. package/dist/es/utils/index.js +1 -1
  189. package/dist/types/components/area/tokens.d.ts +3 -0
  190. package/dist/types/components/avatar/Avatar.d.ts +4 -2
  191. package/dist/types/components/button/ButtonContext.d.ts +2 -16
  192. package/dist/types/components/button/ButtonGroup.d.ts +14 -1
  193. package/dist/types/components/button/index.d.ts +1 -1
  194. package/dist/types/components/checkbox/CheckboxContext.d.ts +2 -16
  195. package/dist/types/components/checkbox/CheckboxGroup.d.ts +15 -1
  196. package/dist/types/components/collapse/Collapse.d.ts +0 -1
  197. package/dist/types/components/config-provider/LocaleContext.d.ts +2 -74
  198. package/dist/types/components/config-provider/tokens.d.ts +3 -0
  199. package/dist/types/components/config-provider/useLocale.d.ts +1 -74
  200. package/dist/types/components/datetime-picker/tokens.d.ts +3 -0
  201. package/dist/types/components/flex/Flex.d.ts +6 -0
  202. package/dist/types/components/flex/FlexContext.d.ts +2 -8
  203. package/dist/types/components/form/Form.d.ts +15 -1
  204. package/dist/types/components/form/FormContext.d.ts +2 -17
  205. package/dist/types/components/form/tokens.d.ts +3 -0
  206. package/dist/types/components/form/utils.d.ts +1 -0
  207. package/dist/types/components/grid/Grid.d.ts +16 -1
  208. package/dist/types/components/grid/GridContext.d.ts +2 -17
  209. package/dist/types/components/index.d.ts +3 -33
  210. package/dist/types/components/loading/index.d.ts +1 -1
  211. package/dist/types/components/notify/Notify.d.ts +1 -0
  212. package/dist/types/components/overlay/Overlay.d.ts +6 -1
  213. package/dist/types/components/overlay/index.d.ts +2 -3
  214. package/dist/types/components/overlay/tokens.d.ts +2 -3
  215. package/dist/types/components/password-input/PasswordInput.d.ts +0 -39
  216. package/dist/types/components/password-input/tokens.d.ts +40 -0
  217. package/dist/types/components/picker/Picker.d.ts +18 -2
  218. package/dist/types/components/picker/index.d.ts +1 -1
  219. package/dist/types/components/portal/Portal.d.ts +4 -6
  220. package/dist/types/components/portal/PortalHost.d.ts +1 -15
  221. package/dist/types/components/portal/tokens.d.ts +3 -0
  222. package/dist/types/components/progress/Progress.d.ts +4 -0
  223. package/dist/types/components/progress/index.d.ts +2 -1
  224. package/dist/types/components/radio/RadioContext.d.ts +2 -13
  225. package/dist/types/components/radio/RadioGroup.d.ts +12 -1
  226. package/dist/types/components/safe-area-view/tokens.d.ts +3 -0
  227. package/dist/types/components/swiper/Swiper.d.ts +4 -2
  228. package/dist/types/components/swiper/SwiperItem.d.ts +1 -5
  229. package/dist/types/components/swiper/tokens.d.ts +3 -0
  230. package/dist/types/components/tabs/Tabs.d.ts +8 -4
  231. package/dist/types/components/tabs/index.d.ts +3 -1
  232. package/dist/types/components/toast/Toast.d.ts +1 -4
  233. package/dist/types/hooks/aria/useAriaListBox.d.ts +0 -6
  234. package/dist/types/hooks/aria/useAriaOverlay.d.ts +0 -10
  235. package/dist/types/hooks/aria/useAriaPress.d.ts +0 -20
  236. package/dist/types/hooks/aria/useAriaToggle.d.ts +0 -3
  237. package/dist/types/hooks/index.d.ts +1 -1
  238. package/dist/types/hooks/overlay/index.d.ts +2 -0
  239. package/dist/types/hooks/useHairline.d.ts +0 -21
  240. package/dist/types/utils/compare.d.ts +2 -0
  241. package/dist/types/utils/index.d.ts +1 -0
  242. package/package.json +10 -48
  243. package/dist/cjs/components/area/utils.js +0 -74
  244. package/dist/cjs/components/cascader/utils.js +0 -20
  245. package/dist/cjs/components/config-provider/locale/base.js +0 -80
  246. package/dist/cjs/components/dropdown-menu/DropdownItem.js +0 -288
  247. package/dist/cjs/components/dropdown-menu/DropdownMenu.js +0 -340
  248. package/dist/cjs/components/dropdown-menu/DropdownMenuContext.js +0 -21
  249. package/dist/cjs/components/dropdown-menu/index.js +0 -25
  250. package/dist/cjs/components/dropdown-menu/tokens.js +0 -67
  251. package/dist/cjs/components/field/utils.js +0 -24
  252. package/dist/cjs/components/index-bar/IndexAnchor.js +0 -74
  253. package/dist/cjs/components/index-bar/IndexBar.js +0 -436
  254. package/dist/cjs/components/index-bar/index.js +0 -25
  255. package/dist/cjs/components/index-bar/tokens.js +0 -45
  256. package/dist/cjs/components/list/List.js +0 -165
  257. package/dist/cjs/components/list/index.js +0 -9
  258. package/dist/cjs/components/list/tokens.js +0 -39
  259. package/dist/cjs/components/notify/defaults.js +0 -15
  260. package/dist/cjs/components/pagination/Pagination.js +0 -160
  261. package/dist/cjs/components/pagination/index.js +0 -22
  262. package/dist/cjs/components/pagination/tokens.js +0 -103
  263. package/dist/cjs/components/picker/WheelPicker.js +0 -492
  264. package/dist/cjs/components/picker/utils.js +0 -138
  265. package/dist/cjs/components/pull-refresh/PullRefresh.js +0 -378
  266. package/dist/cjs/components/pull-refresh/index.js +0 -16
  267. package/dist/cjs/components/pull-refresh/tokens.js +0 -22
  268. package/dist/cjs/components/rate/Rate.js +0 -269
  269. package/dist/cjs/components/rate/index.js +0 -15
  270. package/dist/cjs/components/rate/tokens.js +0 -60
  271. package/dist/cjs/components/slider/utils.js +0 -60
  272. package/dist/cjs/components/swiper/useSwiperWeb.js +0 -209
  273. package/dist/cjs/components/swiper/utils.js +0 -49
  274. package/dist/cjs/components/tabs/TabPane.js +0 -9
  275. package/dist/cjs/components/tabs/useTabsAnimation.js +0 -74
  276. package/dist/cjs/components/tabs/useTabsScroll.js +0 -133
  277. package/dist/cjs/components/tabs/utils.js +0 -34
  278. package/dist/cjs/components/types.js +0 -1
  279. package/dist/cjs/components/uploader/Uploader.js +0 -557
  280. package/dist/cjs/components/uploader/index.js +0 -22
  281. package/dist/cjs/components/uploader/tokens.js +0 -58
  282. package/dist/cjs/components/uploader/utils.js +0 -72
  283. package/dist/cjs/hooks/usePresenceAnimation.js +0 -70
  284. package/dist/es/components/area/utils.js +0 -67
  285. package/dist/es/components/cascader/utils.js +0 -13
  286. package/dist/es/components/config-provider/locale/base.js +0 -74
  287. package/dist/es/components/dropdown-menu/DropdownItem.js +0 -269
  288. package/dist/es/components/dropdown-menu/DropdownMenu.js +0 -320
  289. package/dist/es/components/dropdown-menu/DropdownMenuContext.js +0 -7
  290. package/dist/es/components/dropdown-menu/index.js +0 -7
  291. package/dist/es/components/dropdown-menu/tokens.js +0 -61
  292. package/dist/es/components/field/utils.js +0 -17
  293. package/dist/es/components/index-bar/IndexAnchor.js +0 -55
  294. package/dist/es/components/index-bar/IndexBar.js +0 -417
  295. package/dist/es/components/index-bar/index.js +0 -7
  296. package/dist/es/components/index-bar/tokens.js +0 -39
  297. package/dist/es/components/list/List.js +0 -145
  298. package/dist/es/components/list/index.js +0 -2
  299. package/dist/es/components/list/tokens.js +0 -32
  300. package/dist/es/components/notify/defaults.js +0 -9
  301. package/dist/es/components/pagination/Pagination.js +0 -141
  302. package/dist/es/components/pagination/index.js +0 -4
  303. package/dist/es/components/pagination/tokens.js +0 -91
  304. package/dist/es/components/picker/WheelPicker.js +0 -473
  305. package/dist/es/components/picker/utils.js +0 -127
  306. package/dist/es/components/pull-refresh/PullRefresh.js +0 -359
  307. package/dist/es/components/pull-refresh/index.js +0 -3
  308. package/dist/es/components/pull-refresh/tokens.js +0 -16
  309. package/dist/es/components/rate/Rate.js +0 -250
  310. package/dist/es/components/rate/index.js +0 -3
  311. package/dist/es/components/rate/tokens.js +0 -53
  312. package/dist/es/components/slider/utils.js +0 -49
  313. package/dist/es/components/swiper/useSwiperWeb.js +0 -190
  314. package/dist/es/components/swiper/utils.js +0 -37
  315. package/dist/es/components/tabs/TabPane.js +0 -3
  316. package/dist/es/components/tabs/useTabsAnimation.js +0 -55
  317. package/dist/es/components/tabs/useTabsScroll.js +0 -114
  318. package/dist/es/components/tabs/utils.js +0 -19
  319. package/dist/es/components/types.js +0 -1
  320. package/dist/es/components/uploader/Uploader.js +0 -537
  321. package/dist/es/components/uploader/index.js +0 -4
  322. package/dist/es/components/uploader/tokens.js +0 -52
  323. package/dist/es/components/uploader/utils.js +0 -60
  324. package/dist/es/hooks/usePresenceAnimation.js +0 -51
  325. package/dist/types/components/area/utils.d.ts +0 -2
  326. package/dist/types/components/cascader/utils.d.ts +0 -6
  327. package/dist/types/components/config-provider/locale/base.d.ts +0 -74
  328. package/dist/types/components/dropdown-menu/DropdownItem.d.ts +0 -4
  329. package/dist/types/components/dropdown-menu/DropdownMenu.d.ts +0 -4
  330. package/dist/types/components/dropdown-menu/DropdownMenuContext.d.ts +0 -17
  331. package/dist/types/components/dropdown-menu/index.d.ts +0 -8
  332. package/dist/types/components/dropdown-menu/tokens.d.ts +0 -52
  333. package/dist/types/components/field/utils.d.ts +0 -4
  334. package/dist/types/components/index-bar/IndexAnchor.d.ts +0 -4
  335. package/dist/types/components/index-bar/IndexBar.d.ts +0 -4
  336. package/dist/types/components/index-bar/index.d.ts +0 -9
  337. package/dist/types/components/index-bar/tokens.d.ts +0 -31
  338. package/dist/types/components/list/List.d.ts +0 -4
  339. package/dist/types/components/list/index.d.ts +0 -3
  340. package/dist/types/components/list/tokens.d.ts +0 -4
  341. package/dist/types/components/notify/defaults.d.ts +0 -10
  342. package/dist/types/components/pagination/Pagination.d.ts +0 -5
  343. package/dist/types/components/pagination/index.d.ts +0 -5
  344. package/dist/types/components/pagination/tokens.d.ts +0 -2
  345. package/dist/types/components/picker/WheelPicker.d.ts +0 -21
  346. package/dist/types/components/picker/utils.d.ts +0 -17
  347. package/dist/types/components/pull-refresh/PullRefresh.d.ts +0 -5
  348. package/dist/types/components/pull-refresh/index.d.ts +0 -4
  349. package/dist/types/components/pull-refresh/tokens.d.ts +0 -10
  350. package/dist/types/components/rate/Rate.d.ts +0 -4
  351. package/dist/types/components/rate/index.d.ts +0 -4
  352. package/dist/types/components/rate/tokens.d.ts +0 -4
  353. package/dist/types/components/slider/utils.d.ts +0 -42
  354. package/dist/types/components/swiper/useSwiperWeb.d.ts +0 -41
  355. package/dist/types/components/swiper/utils.d.ts +0 -17
  356. package/dist/types/components/tabs/TabPane.d.ts +0 -4
  357. package/dist/types/components/tabs/useTabsAnimation.d.ts +0 -30
  358. package/dist/types/components/tabs/useTabsScroll.d.ts +0 -23
  359. package/dist/types/components/tabs/utils.d.ts +0 -5
  360. package/dist/types/components/types.d.ts +0 -59
  361. package/dist/types/components/uploader/Uploader.d.ts +0 -4
  362. package/dist/types/components/uploader/index.d.ts +0 -5
  363. package/dist/types/components/uploader/tokens.d.ts +0 -42
  364. package/dist/types/components/uploader/utils.d.ts +0 -11
  365. package/dist/types/hooks/usePresenceAnimation.d.ts +0 -20
  366. /package/dist/cjs/{components → hooks}/overlay/OverlayStackStore.js +0 -0
  367. /package/dist/cjs/{components → hooks}/overlay/useOverlayStack.js +0 -0
  368. /package/dist/es/{components → hooks}/overlay/OverlayStackStore.js +0 -0
  369. /package/dist/es/{components → hooks}/overlay/useOverlayStack.js +0 -0
  370. /package/dist/types/{components → hooks}/overlay/OverlayStackStore.d.ts +0 -0
  371. /package/dist/types/{components → hooks}/overlay/useOverlayStack.d.ts +0 -0
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.SwiperItem = void 0;
7
7
  function _react() {
8
8
  const data = _interopRequireWildcard(require("react"));
9
9
  _react = function () {
@@ -19,775 +19,319 @@ function _reactNative() {
19
19
  return data;
20
20
  }
21
21
  var _number = require("../../utils/number");
22
- var _validate = require("../../utils/validate");
23
- var _SwiperItem = _interopRequireDefault(require("./SwiperItem"));
24
22
  var _SwiperPagIndicator = _interopRequireDefault(require("./SwiperPagIndicator"));
25
- var _utils = require("./utils");
26
- var _useSwiperWeb = require("./useSwiperWeb");
27
23
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
28
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
29
25
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
26
+ const SwiperItem = exports.SwiperItem = /*#__PURE__*/(0, _react().forwardRef)((props, ref) => {
27
+ const {
28
+ style,
29
+ children,
30
+ testID
31
+ } = props;
32
+ return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
33
+ ref: ref,
34
+ style: [styles.item, style],
35
+ testID: testID
36
+ }, children);
37
+ });
38
+ SwiperItem.displayName = 'SwiperItem';
39
+ const DEFAULT_AUTOPLAY_INTERVAL = 3000;
40
+ const LOOP_RENDER_ALL_THRESHOLD = 10;
30
41
  const SwiperImpl = (props, ref) => {
31
42
  const {
43
+ data,
44
+ renderItem,
45
+ children,
32
46
  initialSwipe = 0,
33
47
  touchable = true,
34
- autoplay = false,
35
48
  loop = true,
49
+ autoplay = false,
36
50
  vertical = false,
37
- duration = 300,
38
- enabled = true,
39
- rubberband = true,
40
51
  onChange,
41
- indicator,
52
+ indicator = true,
42
53
  indicatorProps,
43
- slideSize = 100,
44
- trackOffset = 0,
45
- autoHeight = false,
46
- stuckAtBoundary = false,
47
- preventScroll = true,
48
54
  style,
49
- children,
50
- data,
51
- renderItem,
52
55
  testID
53
56
  } = props;
54
- const initialSwipeValue = (0, _utils.getInitialSwipeValue)(initialSwipe);
55
- const durationMs = (0, _utils.getDurationMs)(duration);
56
- const slideSizePct = (0, _utils.getSlideSizePct)(slideSize);
57
- const trackOffsetPct = (0, _utils.getTrackOffsetPct)(trackOffset);
57
+ const flatListRef = (0, _react().useRef)(null);
58
+ const autoplayTimerRef = (0, _react().useRef)(null);
59
+ const isInteractingRef = (0, _react().useRef)(false);
60
+ const isAnimatingRef = (0, _react().useRef)(false);
61
+ const queuedIndexRef = (0, _react().useRef)(null);
62
+ const isMomentumRef = (0, _react().useRef)(false);
63
+ const isWeb = _reactNative().Platform.OS === 'web';
58
64
  const {
59
65
  width: windowWidth,
60
66
  height: windowHeight
61
67
  } = (0, _reactNative().useWindowDimensions)();
62
- const viewportWidth = windowWidth || _utils.FALLBACK_WIDTH;
63
- const viewportHeight = windowHeight || _utils.FALLBACK_HEIGHT;
64
- const [containerLayout, setContainerLayout] = (0, _react().useState)({
68
+ const [layout, setLayout] = (0, _react().useState)({
65
69
  width: 0,
66
70
  height: 0
67
71
  });
68
- const flatListRef = (0, _react().useRef)(null);
69
- const autoplayTimerRef = (0, _react().useRef)(null);
70
- const isDraggingRef = (0, _react().useRef)(false);
71
- const isScrollingRef = (0, _react().useRef)(false);
72
- const nativeMomentumRef = (0, _react().useRef)(false);
73
- const prevIndexRef = (0, _react().useRef)(initialSwipeValue);
74
- const currentDisplayIndexRef = (0, _react().useRef)(initialSwipeValue);
75
- const desiredIndexRef = (0, _react().useRef)(initialSwipeValue);
76
- const isWeb = _reactNative().Platform.OS === 'web';
77
- const nativeQueuedScrollRef = (0, _react().useRef)(null);
78
- const nativeScrollSeqRef = (0, _react().useRef)(0);
79
- const nativeScrollEndTimerRef = (0, _react().useRef)(null);
80
- const scrollToIndexSafe = (0, _react().useCallback)((index, animated) => {
81
- try {
82
- flatListRef.current?.scrollToIndex({
83
- index,
84
- animated
85
- });
86
- } catch {}
87
- }, []);
88
- const clearNativeScrollEndTimer = (0, _react().useCallback)(() => {
89
- if (nativeScrollEndTimerRef.current) {
90
- clearTimeout(nativeScrollEndTimerRef.current);
91
- nativeScrollEndTimerRef.current = null;
92
- }
93
- }, []);
94
- const validChildren = children ? _react().Children.toArray(children).filter(child => {
95
- if (! /*#__PURE__*/(0, _react().isValidElement)(child)) return false;
96
- if (child.type === _SwiperItem.default) return true;
97
- const type = child.type;
98
- return type.displayName === 'SwiperItem';
99
- }) : [];
100
- const itemsData = data ? data : validChildren.length > 0 ? validChildren.map((_, idx) => ({
101
- type: 'child',
102
- index: idx
103
- })) : [];
104
- const count = itemsData.length;
105
- const slideRatio = slideSizePct / 100;
106
- const offsetRatio = trackOffsetPct / 100;
107
- const shouldLoop = loop && count > 1 && slideRatio * (count - 1) >= 1;
108
- const loopData = !shouldLoop || count <= 1 ? itemsData : [...itemsData.slice(-1), ...itemsData, ...itemsData.slice(0, 1)];
109
- const displayData = shouldLoop ? loopData : itemsData;
110
- const displayCount = displayData.length;
111
- const getDisplayIndex = (0, _react().useCallback)(index => {
112
- if (!shouldLoop) return index;
113
- if (index === 0) return count - 1;
114
- if (index === displayCount - 1) return 0;
115
- return index - 1;
116
- }, [shouldLoop, count, displayCount]);
117
- const handleContainerLayout = (0, _react().useCallback)(e => {
72
+ const handleLayout = (0, _react().useCallback)(event => {
118
73
  const {
119
74
  width,
120
75
  height
121
- } = e.nativeEvent.layout;
122
- setContainerLayout(prev => prev.width === width && prev.height === height ? prev : {
76
+ } = event.nativeEvent.layout;
77
+ setLayout(prev => prev.width === width && prev.height === height ? prev : {
123
78
  width,
124
79
  height
125
80
  });
126
81
  }, []);
127
- const containerWidth = containerLayout.width || viewportWidth;
128
- const containerHeight = containerLayout.height || viewportHeight;
129
- const crossAxisMeasured = vertical ? containerLayout.width : containerLayout.height;
130
- const crossAxisSize = crossAxisMeasured > 0 ? crossAxisMeasured : undefined;
131
- const slideSizeValue = (vertical ? containerHeight : containerWidth) * slideRatio;
132
- const itemSizeStyle = {
133
- [vertical ? 'height' : 'width']: slideSizeValue
134
- };
135
- if (crossAxisSize != null && !(autoHeight && !vertical)) {
136
- itemSizeStyle[vertical ? 'width' : 'height'] = crossAxisSize;
137
- }
138
- const mainAxisMeasured = vertical ? containerLayout.height : containerLayout.width;
139
- const trackOffsetPx = mainAxisMeasured > 0 ? mainAxisMeasured * offsetRatio : 0;
140
- const nativeTrackContentPaddingStyle = !trackOffsetPx ? undefined : vertical ? {
141
- paddingTop: trackOffsetPx,
142
- paddingBottom: trackOffsetPx
143
- } : {
144
- paddingLeft: trackOffsetPx,
145
- paddingRight: trackOffsetPx
146
- };
147
- const stuckAtBoundaryEnabled = !!stuckAtBoundary && !shouldLoop && count > 1 && slideRatio < 1;
148
- const mainAxisSize = vertical ? containerHeight : containerWidth;
149
- const nonLoopMinOffset = stuckAtBoundaryEnabled ? trackOffsetPx : 0;
150
- const nonLoopMaxOffset = stuckAtBoundaryEnabled ? Math.max(nonLoopMinOffset, trackOffsetPx + count * slideSizeValue - mainAxisSize, 0) : Math.max(0, (count - 1) * slideSizeValue);
151
- const nonLoopSnapOffsets = (() => {
152
- if (!stuckAtBoundaryEnabled || count <= 1) return null;
153
- const offsets = new Array(count);
154
- for (let i = 0; i < count; i += 1) offsets[i] = i === 0 ? nonLoopMinOffset : i === count - 1 ? nonLoopMaxOffset : slideSizeValue * i;
155
- return offsets;
156
- })();
157
- const getInitialIndex = (0, _react().useCallback)(() => {
158
- const initial = (0, _number.clamp)(initialSwipeValue, 0, count - 1);
159
- return shouldLoop ? initial + 1 : initial;
160
- }, [initialSwipeValue, count, shouldLoop]);
161
- const [current, setCurrent] = (0, _react().useState)(() => getInitialIndex());
162
- const [indicatorIndex, setIndicatorIndex] = (0, _react().useState)(() => getDisplayIndex(getInitialIndex()));
163
- const setCurrentSafe = (0, _react().useCallback)(next => {
164
- setCurrent(prev => prev === next ? prev : next);
82
+ const childItems = (0, _react().useMemo)(() => {
83
+ if (!children) return [];
84
+ return _react().Children.toArray(children).filter(child => /*#__PURE__*/(0, _react().isValidElement)(child));
85
+ }, [children]);
86
+ const usingData = Array.isArray(data);
87
+ const baseItems = (0, _react().useMemo)(() => usingData ? data : childItems, [usingData, data, childItems]);
88
+ const count = baseItems.length;
89
+ const shouldLoop = loop && count > 1;
90
+ const displayData = (0, _react().useMemo)(() => {
91
+ if (!shouldLoop) return baseItems;
92
+ const head = baseItems[count - 1];
93
+ const tail = baseItems[0];
94
+ return [head, ...baseItems, tail];
95
+ }, [baseItems, shouldLoop, count]);
96
+ const displayCount = displayData.length;
97
+ const loopRenderAll = shouldLoop && displayCount <= LOOP_RENDER_ALL_THRESHOLD;
98
+ const getRealIndex = (0, _react().useCallback)(displayIndex => {
99
+ if (!shouldLoop) return (0, _number.clamp)(displayIndex, 0, count - 1);
100
+ if (displayIndex === 0) return count - 1;
101
+ if (displayIndex === displayCount - 1) return 0;
102
+ return displayIndex - 1;
103
+ }, [shouldLoop, count, displayCount]);
104
+ const getDisplayIndex = (0, _react().useCallback)(realIndex => {
105
+ if (!shouldLoop) return (0, _number.clamp)(realIndex, 0, count - 1);
106
+ return (0, _number.clamp)(realIndex, 0, count - 1) + 1;
107
+ }, [shouldLoop, count]);
108
+ const initialRealIndex = (0, _number.clamp)(initialSwipe, 0, Math.max(0, count - 1));
109
+ const initialDisplayIndex = getDisplayIndex(initialRealIndex);
110
+ const currentIndexRef = (0, _react().useRef)(initialRealIndex);
111
+ const [currentIndex, setCurrentIndex] = (0, _react().useState)(initialRealIndex);
112
+ const layoutReady = layout.width > 0 && layout.height > 0;
113
+ const mainSize = vertical ? layout.height || windowHeight || 1 : layout.width || windowWidth || 1;
114
+ const crossSize = vertical ? layout.width || windowWidth || 1 : layout.height || windowHeight || 1;
115
+ const itemStyle = (0, _react().useMemo)(() => ({
116
+ width: vertical ? crossSize : mainSize,
117
+ height: vertical ? mainSize : crossSize
118
+ }), [vertical, mainSize, crossSize]);
119
+ const clearAutoplay = (0, _react().useCallback)(() => {
120
+ if (autoplayTimerRef.current) {
121
+ clearTimeout(autoplayTimerRef.current);
122
+ autoplayTimerRef.current = null;
123
+ }
165
124
  }, []);
166
- const [enabledState, setEnabledState] = (0, _react().useState)(enabled);
167
- const autoHeightEnabled = autoHeight && !vertical;
168
- const [autoHeightValue, setAutoHeightValue] = (0, _react().useState)(undefined);
169
- const measuredHeightsRef = (0, _react().useRef)({});
170
- const swipeToRef = (0, _react().useRef)(() => {});
171
- const onDragStartRef = (0, _react().useRef)(() => {});
172
- const onDragEndRef = (0, _react().useRef)(() => {});
173
- const {
174
- webOffsetRef,
175
- webTranslateXAnim,
176
- webTranslateYAnim,
177
- webTrackTransform,
178
- panResponder,
179
- stopWebSnapAnim,
180
- cancelWebRaf,
181
- webSnapAnimRef
182
- } = (0, _useSwiperWeb.useSwiperWeb)({
183
- isWeb,
184
- enabledState,
185
- touchable,
186
- vertical,
187
- count,
188
- shouldLoop,
189
- displayCount,
190
- slideSizeValue,
191
- nonLoopMinOffset,
192
- nonLoopMaxOffset,
193
- durationMs,
194
- preventScroll,
195
- trackOffsetPx,
196
- swipeToRef,
197
- onDragStart: () => onDragStartRef.current(),
198
- onDragEnd: () => onDragEndRef.current()
199
- });
200
- (0, _react().useEffect)(() => {
201
- return () => {
202
- cancelWebRaf();
203
- stopWebSnapAnim();
204
- clearNativeScrollEndTimer();
205
- };
206
- }, [cancelWebRaf, stopWebSnapAnim, clearNativeScrollEndTimer]);
207
- const finishNativeScroll = (0, _react().useCallback)(() => {
208
- clearNativeScrollEndTimer();
209
- isScrollingRef.current = false;
210
- nativeMomentumRef.current = false;
211
- const queued = nativeQueuedScrollRef.current;
212
- if (queued && flatListRef.current) {
213
- nativeQueuedScrollRef.current = null;
214
- const nextRealIndex = getDisplayIndex(queued.index);
215
- (0, _utils.runAfterFrames)(1, () => {
216
- swipeToRef.current(nextRealIndex, queued.animated);
125
+ const updateIndex = (0, _react().useCallback)(next => {
126
+ const clamped = (0, _number.clamp)(next, 0, Math.max(0, count - 1));
127
+ if (currentIndexRef.current === clamped) return;
128
+ currentIndexRef.current = clamped;
129
+ setCurrentIndex(clamped);
130
+ onChange?.(clamped);
131
+ }, [count, onChange]);
132
+ const scrollToDisplayIndex = (0, _react().useCallback)((displayIndex, animated) => {
133
+ try {
134
+ flatListRef.current?.scrollToIndex({
135
+ index: displayIndex,
136
+ animated
217
137
  });
218
- }
219
- }, [clearNativeScrollEndTimer, getDisplayIndex]);
220
- const scheduleNativeScrollFallback = (0, _react().useCallback)(() => {
221
- clearNativeScrollEndTimer();
222
- const seq = nativeScrollSeqRef.current + 1;
223
- nativeScrollSeqRef.current = seq;
224
- const timeout = Math.max(700, durationMs + 500);
225
- nativeScrollEndTimerRef.current = setTimeout(() => {
226
- if (nativeScrollSeqRef.current !== seq) return;
227
- if (isDraggingRef.current) return;
228
- if (!isScrollingRef.current) return;
229
- finishNativeScroll();
230
- }, timeout);
231
- }, [clearNativeScrollEndTimer, durationMs, finishNativeScroll]);
232
- (0, _react().useEffect)(() => {
233
- setEnabledState(enabled);
234
- }, [enabled]);
235
- const currentRef = (0, _react().useRef)(current);
236
- (0, _react().useEffect)(() => {
237
- currentRef.current = current;
238
- desiredIndexRef.current = getDisplayIndex(current);
239
- }, [current, getDisplayIndex]);
240
- const handleItemLayout = (0, _react().useCallback)((displayIndex, e) => {
241
- if (!autoHeightEnabled) return;
242
- const height = e.nativeEvent.layout.height;
243
- if (!height) return;
244
- const realIndex = getDisplayIndex(displayIndex);
245
- const prevHeight = measuredHeightsRef.current[realIndex];
246
- if (prevHeight != null && Math.abs(prevHeight - height) < 0.5) return;
247
- measuredHeightsRef.current[realIndex] = height;
248
- const activeRealIndex = getDisplayIndex(currentRef.current);
249
- if (realIndex === activeRealIndex) {
250
- setAutoHeightValue(height);
251
- }
252
- }, [autoHeightEnabled, getDisplayIndex]);
253
- (0, _react().useEffect)(() => {
254
- if (!autoHeightEnabled) return;
255
- measuredHeightsRef.current = {};
256
- setAutoHeightValue(undefined);
257
- }, [autoHeightEnabled, slideSizeValue, count]);
258
- (0, _react().useEffect)(() => {
259
- if (!autoHeightEnabled) return;
260
- const activeRealIndex = getDisplayIndex(current);
261
- const height = measuredHeightsRef.current[activeRealIndex];
262
- if (height == null) return;
263
- setAutoHeightValue(height);
264
- }, [autoHeightEnabled, current, getDisplayIndex]);
265
- const containerAutoHeightStyle = autoHeightEnabled && autoHeightValue != null ? {
266
- height: autoHeightValue
267
- } : undefined;
268
- const nativeLastAlignedMainAxisRef = (0, _react().useRef)(0);
269
- (0, _react().useEffect)(() => {
270
- if (isWeb) return;
271
- if (count === 0) return;
272
- if (!flatListRef.current) return;
273
- if (isDraggingRef.current || isScrollingRef.current) return;
274
- const mainAxisMeasured = vertical ? containerLayout.height : containerLayout.width;
275
- if (mainAxisMeasured <= 0) return;
276
- const lastAligned = nativeLastAlignedMainAxisRef.current;
277
- if (lastAligned > 0 && Math.abs(mainAxisMeasured - lastAligned) < 0.5) return;
278
- nativeLastAlignedMainAxisRef.current = mainAxisMeasured;
279
- (0, _utils.runAfterFrames)(2, () => {
280
- scrollToIndexSafe(currentRef.current, false);
281
- });
282
- }, [isWeb, count, vertical, containerLayout.height, containerLayout.width]);
138
+ } catch {}
139
+ }, []);
283
140
  const swipeTo = (0, _react().useCallback)((index, animated = true) => {
284
141
  if (count === 0) return;
142
+ if (animated && isAnimatingRef.current) {
143
+ queuedIndexRef.current = index;
144
+ return;
145
+ }
285
146
  const targetRealIndex = (0, _number.clamp)(index, 0, count - 1);
286
- const fromRealIndex = desiredIndexRef.current;
287
- desiredIndexRef.current = targetRealIndex;
288
- const currentIndex = currentRef.current;
289
- let targetIndex;
290
- let needsJump = false;
291
- let jumpOffset = null;
292
- let jumpDisplayIndex = null;
293
- if (shouldLoop) {
294
- if (fromRealIndex === count - 1 && targetRealIndex === 0) {
295
- targetIndex = displayCount - 1;
296
- needsJump = true;
297
- jumpOffset = -1 * slideSizeValue;
298
- jumpDisplayIndex = 1;
299
- } else if (fromRealIndex === 0 && targetRealIndex === count - 1) {
300
- targetIndex = 0;
301
- needsJump = true;
302
- jumpOffset = -count * slideSizeValue;
303
- jumpDisplayIndex = count;
304
- } else {
305
- targetIndex = targetRealIndex + 1;
147
+ let targetDisplayIndex = getDisplayIndex(targetRealIndex);
148
+ let resolvedAnimated = animated;
149
+ if (isWeb && shouldLoop && animated) {
150
+ const currentRealIndex = currentIndexRef.current;
151
+ if (currentRealIndex === count - 1 && targetRealIndex === 0 || currentRealIndex === 0 && targetRealIndex === count - 1) {
152
+ resolvedAnimated = false;
306
153
  }
307
- } else {
308
- targetIndex = targetRealIndex;
309
154
  }
310
- if (isWeb) {
311
- if (!needsJump && targetIndex === currentIndex) {
312
- if (autoplay && enabledState) startAutoplay();
313
- return;
314
- }
315
- stopWebSnapAnim();
316
- const offset = shouldLoop ? -targetIndex * slideSizeValue : -1 * (nonLoopSnapOffsets?.[targetIndex] ?? slideSizeValue * targetIndex);
317
- webOffsetRef.current = offset;
318
- if (needsJump) {
319
- if (animated) {
320
- const animValue = vertical ? webTranslateYAnim : webTranslateXAnim;
321
- const anim = _reactNative().Animated.timing(animValue, {
322
- toValue: offset,
323
- duration: durationMs,
324
- easing: _reactNative().Easing.out(_reactNative().Easing.cubic),
325
- useNativeDriver: false
326
- });
327
- webSnapAnimRef.current = anim;
328
- anim.start(({
329
- finished
330
- }) => {
331
- webSnapAnimRef.current = null;
332
- if (autoplay && enabledState) startAutoplay();
333
- if (!finished || jumpOffset === null || jumpDisplayIndex === null) return;
334
- webOffsetRef.current = jumpOffset;
335
- if (vertical) {
336
- webTranslateYAnim.setValue(jumpOffset);
337
- } else {
338
- webTranslateXAnim.setValue(jumpOffset);
339
- }
340
- setCurrentSafe(jumpDisplayIndex);
341
- });
342
- setCurrentSafe(targetIndex);
343
- } else {
344
- if (vertical) {
345
- webTranslateYAnim.setValue(jumpOffset);
346
- } else {
347
- webTranslateXAnim.setValue(jumpOffset);
348
- }
349
- webOffsetRef.current = jumpOffset;
350
- setCurrentSafe(jumpDisplayIndex);
351
- if (autoplay && enabledState) startAutoplay();
352
- }
353
- } else {
354
- const animValue = vertical ? webTranslateYAnim : webTranslateXAnim;
355
- if (animated) {
356
- const anim = _reactNative().Animated.timing(animValue, {
357
- toValue: offset,
358
- duration: durationMs,
359
- easing: _reactNative().Easing.out(_reactNative().Easing.cubic),
360
- useNativeDriver: false
361
- });
362
- webSnapAnimRef.current = anim;
363
- anim.start(() => {
364
- webSnapAnimRef.current = null;
365
- if (autoplay && enabledState) startAutoplay();
366
- });
367
- } else {
368
- animValue.setValue(offset);
369
- if (autoplay && enabledState) startAutoplay();
370
- }
371
- setCurrentSafe(targetIndex);
155
+ if (shouldLoop && resolvedAnimated) {
156
+ const currentDisplayIndex = getDisplayIndex(currentIndexRef.current);
157
+ if (currentDisplayIndex === count && targetRealIndex === 0) {
158
+ targetDisplayIndex = displayCount - 1;
159
+ } else if (currentDisplayIndex === 1 && targetRealIndex === count - 1) {
160
+ targetDisplayIndex = 0;
372
161
  }
373
- } else if (flatListRef.current) {
374
- if (!needsJump && targetIndex === currentIndex) {
375
- finishNativeScroll();
376
- if (autoplay && enabledState) startAutoplay();
377
- return;
378
- }
379
- if (isDraggingRef.current && animated) {
380
- nativeQueuedScrollRef.current = {
381
- index: targetIndex,
382
- animated
383
- };
384
- return;
385
- }
386
- if (isScrollingRef.current && animated) {
387
- nativeQueuedScrollRef.current = {
388
- index: targetIndex,
389
- animated
390
- };
391
- scheduleNativeScrollFallback();
392
- scrollToIndexSafe(targetIndex, true);
393
- return;
394
- }
395
- isScrollingRef.current = true;
396
- if (animated) {
397
- scheduleNativeScrollFallback();
398
- } else {
399
- clearNativeScrollEndTimer();
400
- }
401
- scrollToIndexSafe(targetIndex, animated);
402
- if (!animated) {
403
- setCurrentSafe(targetIndex);
404
- if (autoplay && enabledState) startAutoplay();
405
- }
406
- if (needsJump && jumpDisplayIndex != null && !animated) {
407
- (0, _utils.runAfterFrames)(2, () => {
408
- flatListRef.current?.scrollToIndex({
409
- index: jumpDisplayIndex,
410
- animated: false
411
- });
412
- setCurrentSafe(jumpDisplayIndex);
413
- });
162
+ }
163
+ const currentRealIndex = currentIndexRef.current;
164
+ const currentDisplayIndex = getDisplayIndex(currentRealIndex);
165
+ if (targetRealIndex === currentRealIndex && targetDisplayIndex === currentDisplayIndex) {
166
+ if (queuedIndexRef.current != null) {
167
+ const next = queuedIndexRef.current;
168
+ queuedIndexRef.current = null;
169
+ swipeTo(next, true);
414
170
  }
415
- if (!animated) {
416
- (0, _utils.runAfterFrames)(1, () => {
417
- finishNativeScroll();
418
- });
171
+ return;
172
+ }
173
+ if (resolvedAnimated) {
174
+ isAnimatingRef.current = true;
175
+ }
176
+ scrollToDisplayIndex(targetDisplayIndex, resolvedAnimated);
177
+ if (!resolvedAnimated) {
178
+ updateIndex(targetRealIndex);
179
+ if (queuedIndexRef.current != null) {
180
+ const next = queuedIndexRef.current;
181
+ queuedIndexRef.current = null;
182
+ swipeTo(next, true);
419
183
  }
420
184
  }
421
- }, [count, shouldLoop, isWeb, slideSizeValue, vertical, webTranslateXAnim, webTranslateYAnim, nonLoopSnapOffsets, displayCount, stopWebSnapAnim, setCurrentSafe, durationMs, clearNativeScrollEndTimer, finishNativeScroll, scheduleNativeScrollFallback]);
422
- (0, _react().useEffect)(() => {
423
- swipeToRef.current = swipeTo;
424
- }, [swipeTo]);
185
+ }, [count, getDisplayIndex, scrollToDisplayIndex, shouldLoop, displayCount, updateIndex, isWeb]);
186
+ const resolveAutoplayInterval = (0, _react().useCallback)(() => {
187
+ if (typeof autoplay === 'number') return Math.max(0, autoplay);
188
+ if (autoplay) return DEFAULT_AUTOPLAY_INTERVAL;
189
+ return 0;
190
+ }, [autoplay]);
191
+ const scheduleAutoplay = (0, _react().useCallback)(() => {
192
+ const interval = resolveAutoplayInterval();
193
+ if (!interval || count <= 1) return;
194
+ if (isInteractingRef.current && !isWeb) return;
195
+ clearAutoplay();
196
+ autoplayTimerRef.current = setTimeout(() => {
197
+ if (isInteractingRef.current && !isWeb) return;
198
+ const nextIndex = shouldLoop ? (currentIndexRef.current + 1) % count : (0, _number.clamp)(currentIndexRef.current + 1, 0, count - 1);
199
+ swipeTo(nextIndex, true);
200
+ }, interval);
201
+ }, [resolveAutoplayInterval, count, clearAutoplay, shouldLoop, swipeTo]);
425
202
  const swipeNext = (0, _react().useCallback)(() => {
426
203
  if (count === 0) return;
427
- const baseIndex = desiredIndexRef.current;
428
- swipeTo(baseIndex === count - 1 ? 0 : baseIndex + 1);
429
- }, [count, swipeTo]);
204
+ const next = shouldLoop ? (currentIndexRef.current + 1) % count : (0, _number.clamp)(currentIndexRef.current + 1, 0, count - 1);
205
+ swipeTo(next, true);
206
+ }, [count, shouldLoop, swipeTo]);
430
207
  const swipePrev = (0, _react().useCallback)(() => {
431
208
  if (count === 0) return;
432
- const baseIndex = desiredIndexRef.current;
433
- swipeTo(baseIndex === 0 ? count - 1 : baseIndex - 1);
434
- }, [count, swipeTo]);
435
- const stopAutoplay = (0, _react().useCallback)(() => {
436
- if (autoplayTimerRef.current) {
437
- clearTimeout(autoplayTimerRef.current);
438
- autoplayTimerRef.current = null;
439
- }
440
- }, []);
441
- const startAutoplay = (0, _react().useCallback)(delay => {
442
- if (!autoplay || count <= 1 || !enabledState) return;
443
- if (isDraggingRef.current || isScrollingRef.current) return;
444
- stopAutoplay();
445
- const interval = (0, _validate.isFiniteNumber)(autoplay) && Math.max(0, autoplay) || 5000;
446
- autoplayTimerRef.current = setTimeout(() => {
447
- if (isDraggingRef.current || isScrollingRef.current) return;
448
- swipeNext();
449
- startAutoplay();
450
- }, delay ?? interval);
451
- }, [autoplay, count, enabledState, swipeNext, stopAutoplay]);
452
- const handleNativeScrollEndByOffset = (0, _react().useCallback)(offset => {
453
- if (count === 0) return;
454
- clearNativeScrollEndTimer();
455
- isScrollingRef.current = false;
456
- nativeMomentumRef.current = false;
457
- if (!slideSizeValue) return;
458
- let index = Math.round(offset / slideSizeValue);
459
- if (shouldLoop) {
460
- if (index === 0) {
461
- (0, _utils.runAfterFrames)(2, () => {
462
- flatListRef.current?.scrollToIndex({
463
- index: count,
464
- animated: false
465
- });
466
- });
467
- index = count;
468
- } else if (index === displayCount - 1) {
469
- (0, _utils.runAfterFrames)(2, () => {
470
- flatListRef.current?.scrollToIndex({
471
- index: 1,
472
- animated: false
473
- });
474
- });
475
- index = 1;
476
- }
477
- } else {
478
- index = (0, _number.clamp)(index, 0, count - 1);
479
- }
480
- setCurrentSafe(index);
481
- desiredIndexRef.current = getDisplayIndex(index);
482
- const queued = nativeQueuedScrollRef.current;
483
- if (queued && flatListRef.current) {
484
- nativeQueuedScrollRef.current = null;
485
- const nextDisplayIndex = getDisplayIndex(queued.index);
486
- (0, _utils.runAfterFrames)(1, () => {
487
- swipeTo(nextDisplayIndex, queued.animated);
488
- });
489
- } else if (autoplay && enabledState) {
490
- startAutoplay();
491
- }
492
- }, [clearNativeScrollEndTimer, count, displayCount, getDisplayIndex, setCurrentSafe, shouldLoop, slideSizeValue, swipeTo, autoplay, enabledState, startAutoplay]);
493
- const handleScrollEnd = (0, _react().useCallback)(event => {
494
- if (count === 0) return;
495
- const {
496
- contentOffset
497
- } = event.nativeEvent;
498
- handleNativeScrollEndByOffset(vertical ? contentOffset.y : contentOffset.x);
499
- }, [count, handleNativeScrollEndByOffset, vertical]);
209
+ const next = shouldLoop ? (currentIndexRef.current - 1 + count) % count : (0, _number.clamp)(currentIndexRef.current - 1, 0, count - 1);
210
+ swipeTo(next, true);
211
+ }, [count, shouldLoop, swipeTo]);
212
+ const flushQueuedSwipe = () => {
213
+ if (queuedIndexRef.current == null) return;
214
+ const next = queuedIndexRef.current;
215
+ queuedIndexRef.current = null;
216
+ swipeTo(next, true);
217
+ };
218
+ (0, _react().useImperativeHandle)(ref, () => ({
219
+ swipeTo,
220
+ swipeNext,
221
+ swipePrev,
222
+ getCurrentIndex: () => currentIndexRef.current
223
+ }), [swipeTo, swipeNext, swipePrev]);
224
+ (0, _react().useEffect)(() => {
225
+ if (!layoutReady || count === 0) return;
226
+ scrollToDisplayIndex(initialDisplayIndex, false);
227
+ }, [layoutReady, count, initialDisplayIndex, scrollToDisplayIndex]);
228
+ (0, _react().useEffect)(() => {
229
+ scheduleAutoplay();
230
+ return clearAutoplay;
231
+ }, [scheduleAutoplay, clearAutoplay, currentIndex]);
500
232
  const handleScrollBeginDrag = () => {
501
- isDraggingRef.current = true;
502
- isScrollingRef.current = true;
503
- stopAutoplay();
233
+ isInteractingRef.current = true;
234
+ clearAutoplay();
504
235
  };
505
- const handleScrollEndDrag = event => {
506
- isDraggingRef.current = false;
507
- const {
508
- contentOffset
509
- } = event.nativeEvent;
510
- (0, _utils.runAfterFrames)(1, () => {
511
- if (nativeMomentumRef.current) return;
512
- handleNativeScrollEndByOffset(vertical ? contentOffset.y : contentOffset.x);
513
- });
236
+ const handleScroll = event => {
237
+ if (!isWeb || count <= 1) return;
238
+ const offset = vertical ? event.nativeEvent.contentOffset.y : event.nativeEvent.contentOffset.x;
239
+ const displayIndex = Math.round(offset / mainSize);
240
+ const nextDisplayIndex = shouldLoop ? (0, _number.clamp)(displayIndex, 0, displayCount - 1) : (0, _number.clamp)(displayIndex, 0, count - 1);
241
+ updateIndex(getRealIndex(nextDisplayIndex));
242
+ const alignedOffset = Math.round(offset / mainSize) * mainSize;
243
+ if (Math.abs(offset - alignedOffset) < 0.5) {
244
+ isAnimatingRef.current = false;
245
+ isInteractingRef.current = false;
246
+ isMomentumRef.current = false;
247
+ scheduleAutoplay();
248
+ flushQueuedSwipe();
249
+ }
514
250
  };
515
251
  const handleMomentumScrollBegin = () => {
516
- nativeMomentumRef.current = true;
517
- isScrollingRef.current = true;
252
+ isMomentumRef.current = true;
518
253
  };
519
- const indicatorRafIdRef = (0, _react().useRef)(null);
520
- const indicatorPendingRef = (0, _react().useRef)(null);
521
- const canUseRaf = typeof requestAnimationFrame === 'function' && typeof cancelAnimationFrame === 'function';
522
- const flushIndicator = () => {
523
- const next = indicatorPendingRef.current;
524
- if (next == null) return;
525
- indicatorPendingRef.current = null;
526
- setIndicatorIndex(prev => prev === next ? prev : next);
254
+ const handleScrollEndDrag = event => {
255
+ if (isMomentumRef.current) return;
256
+ handleScrollEnd(event);
527
257
  };
528
- const scheduleIndicator = next => {
529
- indicatorPendingRef.current = next;
530
- if (indicatorRafIdRef.current != null) return;
531
- if (canUseRaf) {
532
- indicatorRafIdRef.current = requestAnimationFrame(() => {
533
- indicatorRafIdRef.current = null;
534
- flushIndicator();
535
- });
536
- return;
258
+ const handleScrollEnd = event => {
259
+ if (count === 0) return;
260
+ const offset = vertical ? event.nativeEvent.contentOffset.y : event.nativeEvent.contentOffset.x;
261
+ const displayIndex = Math.round(offset / mainSize);
262
+ let nextDisplayIndex = displayIndex;
263
+ if (shouldLoop) {
264
+ if (displayIndex === 0) nextDisplayIndex = count;
265
+ if (displayIndex === displayCount - 1) nextDisplayIndex = 1;
537
266
  }
538
- indicatorRafIdRef.current = setTimeout(() => {
539
- indicatorRafIdRef.current = null;
540
- flushIndicator();
541
- }, 16);
542
- };
543
- (0, _react().useEffect)(() => {
544
- setIndicatorIndex(prev => {
545
- const next = getDisplayIndex(current);
546
- return prev === next ? prev : next;
547
- });
548
- }, [current, getDisplayIndex]);
549
- (0, _react().useEffect)(() => {
550
- return () => {
551
- if (indicatorRafIdRef.current != null) {
552
- if (canUseRaf) {
553
- cancelAnimationFrame(indicatorRafIdRef.current);
554
- } else {
555
- clearTimeout(indicatorRafIdRef.current);
556
- }
557
- indicatorRafIdRef.current = null;
558
- }
559
- indicatorPendingRef.current = null;
560
- };
561
- }, []);
562
- const handleScroll = (0, _react().useCallback)(event => {
563
- if (isWeb || count <= 1 || !slideSizeValue) return;
564
- const {
565
- contentOffset
566
- } = event.nativeEvent;
567
- const offset = vertical ? contentOffset.y : contentOffset.x;
568
- const displayIndex = shouldLoop ? (0, _number.clamp)(Math.round(offset / slideSizeValue), 0, displayCount - 1) : (0, _number.clamp)(Math.round(offset / slideSizeValue), 0, count - 1);
569
- scheduleIndicator(getDisplayIndex(displayIndex));
570
- }, [count, displayCount, getDisplayIndex, isWeb, scheduleIndicator, shouldLoop, slideSizeValue, vertical]);
571
- (0, _react().useEffect)(() => {
572
- onDragStartRef.current = () => {
573
- isDraggingRef.current = true;
574
- stopAutoplay();
575
- };
576
- onDragEndRef.current = () => {
577
- isDraggingRef.current = false;
578
- };
579
- }, [stopAutoplay]);
580
- (0, _react().useEffect)(() => {
581
- startAutoplay();
582
- return stopAutoplay;
583
- }, [startAutoplay, stopAutoplay]);
584
- (0, _react().useImperativeHandle)(ref, () => ({
585
- activeIndex: getDisplayIndex(current),
586
- swipeTo: (index, animated = true) => {
587
- swipeTo(index, animated);
588
- },
589
- swipeNext,
590
- swipePrev,
591
- enable: () => {
592
- setEnabledState(true);
593
- },
594
- disable: () => {
595
- setEnabledState(false);
596
- },
597
- getCurrentIndex: () => getDisplayIndex(current),
598
- getPrevIndex: () => prevIndexRef.current,
599
- goToFirstIndex: () => {
600
- swipeTo(0);
601
- },
602
- goToLastIndex: () => {
603
- swipeTo(count - 1);
267
+ if (nextDisplayIndex !== displayIndex) {
268
+ scrollToDisplayIndex(nextDisplayIndex, false);
604
269
  }
605
- }), [current, count, getDisplayIndex, swipeTo, swipeNext, swipePrev]);
270
+ updateIndex(getRealIndex(nextDisplayIndex));
271
+ isInteractingRef.current = false;
272
+ isAnimatingRef.current = false;
273
+ isMomentumRef.current = false;
274
+ scheduleAutoplay();
275
+ flushQueuedSwipe();
276
+ };
606
277
  const renderIndicator = () => {
607
278
  if (indicator === false || count <= 1) return null;
608
- if (typeof indicator === 'function') return indicator(count, indicatorIndex);
279
+ if (typeof indicator === 'function') return indicator(count, currentIndex);
609
280
  return /*#__PURE__*/_react().default.createElement(_SwiperPagIndicator.default, _extends({}, indicatorProps, {
610
281
  total: count,
611
- current: indicatorIndex,
282
+ current: currentIndex,
612
283
  vertical: vertical
613
284
  }));
614
285
  };
615
- (0, _react().useEffect)(() => {
616
- if (!onChange || count <= 0) return;
617
- const nextDisplay = getDisplayIndex(current);
618
- if (nextDisplay === currentDisplayIndexRef.current) return;
619
- prevIndexRef.current = currentDisplayIndexRef.current;
620
- currentDisplayIndexRef.current = nextDisplay;
621
- onChange(nextDisplay);
622
- }, [current, onChange, count, getDisplayIndex]);
623
- const renderChildItem = (0, _react().useCallback)(({
624
- item,
625
- index
626
- }) => {
627
- const marker = item;
628
- if (marker.type !== 'child') return null;
629
- const childIndex = typeof marker.index === 'number' ? marker.index : -1;
630
- const child = validChildren[childIndex];
631
- if (!child) return null;
632
- if (!autoHeightEnabled) {
633
- const element = child;
634
- return /*#__PURE__*/(0, _react().cloneElement)(element, {
635
- style: [element.props.style, itemSizeStyle]
636
- });
637
- }
638
- const element = child;
639
- return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
640
- style: itemSizeStyle,
641
- onLayout: e => handleItemLayout(index, e),
642
- collapsable: false
643
- }, /*#__PURE__*/(0, _react().cloneElement)(element, {
644
- style: [element.props.style, styles.autoHeightChild]
645
- }));
646
- }, [validChildren, itemSizeStyle, autoHeightEnabled, handleItemLayout]);
647
- const renderDataItem = (0, _react().useCallback)(info => {
648
- if (!renderItem) return null;
649
- const item = renderItem(info);
650
- if (!item) return null;
651
- const itemIndex = info.index;
652
- return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
653
- style: itemSizeStyle,
654
- onLayout: autoHeightEnabled ? e => handleItemLayout(itemIndex, e) : undefined,
655
- collapsable: false
656
- }, item);
657
- }, [renderItem, itemSizeStyle, autoHeightEnabled, handleItemLayout]);
658
- const getItemKey = (0, _react().useCallback)((_item, index) => {
659
- if (shouldLoop && count > 1) {
660
- if (index === 0) return `loop-last-${count - 1}`;
661
- if (index === displayCount - 1) return `loop-first-0`;
662
- return `item-${index - 1}`;
663
- }
664
- return `item-${index}`;
665
- }, [shouldLoop, count, displayCount]);
666
- const getItemLayout = (0, _react().useCallback)((_, index) => {
667
- const offset = !shouldLoop && nonLoopSnapOffsets ? nonLoopSnapOffsets[index] ?? slideSizeValue * index : slideSizeValue * index;
668
- return {
669
- length: slideSizeValue,
670
- offset,
671
- index
672
- };
673
- }, [nonLoopSnapOffsets, shouldLoop, slideSizeValue]);
674
- const snapToOffsets = (() => {
675
- if (slideSizePct === 100 && trackOffsetPct === 0) return undefined;
676
- if (!shouldLoop && nonLoopSnapOffsets) return nonLoopSnapOffsets;
677
- return displayData.map((_, index) => slideSizeValue * index);
678
- })();
679
- (0, _react().useEffect)(() => {
680
- if (!isWeb) return;
681
- const initialIndex = getInitialIndex();
682
- const initialOffset = shouldLoop ? -initialIndex * slideSizeValue : -1 * (nonLoopSnapOffsets?.[initialIndex] ?? slideSizeValue * initialIndex);
683
- webOffsetRef.current = initialOffset;
684
- if (vertical) webTranslateYAnim.setValue(initialOffset);else webTranslateXAnim.setValue(initialOffset);
685
- }, [isWeb, getInitialIndex, nonLoopSnapOffsets, shouldLoop, slideSizeValue, vertical, webTranslateXAnim, webTranslateYAnim]);
686
- (0, _react().useEffect)(() => {
687
- if (!isWeb || count === 0) return;
688
- const offset = shouldLoop ? -currentRef.current * slideSizeValue : -1 * (nonLoopSnapOffsets?.[currentRef.current] ?? slideSizeValue * currentRef.current);
689
- webOffsetRef.current = offset;
690
- if (vertical) webTranslateYAnim.setValue(offset);else webTranslateXAnim.setValue(offset);
691
- }, [isWeb, count, nonLoopSnapOffsets, shouldLoop, slideSizeValue, vertical, webTranslateXAnim, webTranslateYAnim]);
692
- if (count === 0) {
693
- return null;
694
- }
695
- if (isWeb) {
286
+ const renderSlide = (0, _react().useCallback)(info => {
287
+ const content = usingData ? renderItem?.(info) ?? null : info.item;
288
+ if (!content) return null;
696
289
  return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
697
- style: [styles.container, webContainerStyle, containerAutoHeightStyle, style],
698
- testID: testID,
699
- onLayout: handleContainerLayout
700
- }, /*#__PURE__*/_react().default.createElement(_reactNative().View, {
701
- style: {
702
- overflow: 'hidden',
703
- width: '100%',
704
- height: '100%'
705
- }
706
- }, /*#__PURE__*/_react().default.createElement(_reactNative().Animated.View, _extends({}, panResponder?.panHandlers || {}, {
707
- style: [{
708
- flexDirection: vertical ? 'column' : 'row',
709
- width: vertical ? '100%' : displayCount * slideSizeValue,
710
- height: vertical ? displayCount * slideSizeValue : '100%',
711
- transform: webTrackTransform
712
- }]
713
- }), displayData.map((item, index) => /*#__PURE__*/_react().default.createElement(_reactNative().View, {
714
- key: getItemKey(item, index),
715
- style: [itemSizeStyle, styles.webSlideWrapper]
716
- }, data && renderDataItem({
717
- item,
718
- index
719
- }) || renderChildItem({
720
- item,
721
- index
722
- }))))), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
723
- pointerEvents: "none",
724
- style: styles.indicatorOverlay
725
- }, renderIndicator()));
726
- }
290
+ style: [styles.slide, itemStyle]
291
+ }, content);
292
+ }, [usingData, renderItem, itemStyle]);
293
+ if (count === 0) return null;
727
294
  return /*#__PURE__*/_react().default.createElement(_reactNative().View, {
728
- style: [styles.container, containerAutoHeightStyle, style],
729
- testID: testID,
730
- onLayout: handleContainerLayout,
731
- collapsable: false
295
+ style: [styles.container, style],
296
+ onLayout: handleLayout,
297
+ testID: testID
732
298
  }, /*#__PURE__*/_react().default.createElement(_reactNative().FlatList, {
733
299
  ref: flatListRef,
734
300
  data: displayData,
735
- keyExtractor: getItemKey,
736
- renderItem: data ? renderDataItem : renderChildItem,
737
- getItemLayout: getItemLayout,
301
+ renderItem: renderSlide,
302
+ keyExtractor: (_item, index) => `swiper-${index}`,
738
303
  horizontal: !vertical,
739
- removeClippedSubviews: !isWeb,
740
- initialNumToRender: Math.min(displayCount, 3),
741
- maxToRenderPerBatch: 3,
742
- windowSize: 5,
743
- updateCellsBatchingPeriod: 16,
744
- snapToInterval: slideSizePct === 100 && trackOffsetPct === 0 && slideSizeValue || undefined,
745
- snapToOffsets: snapToOffsets,
746
- snapToAlignment: "start",
304
+ getItemLayout: (_, index) => ({
305
+ length: mainSize,
306
+ offset: mainSize * index,
307
+ index
308
+ }),
309
+ initialScrollIndex: layoutReady ? initialDisplayIndex : undefined,
310
+ scrollEnabled: touchable && count > 1,
311
+ removeClippedSubviews: !shouldLoop || !loopRenderAll,
312
+ disableVirtualization: shouldLoop && loopRenderAll,
313
+ initialNumToRender: shouldLoop ? loopRenderAll ? displayCount : 3 : 3,
314
+ maxToRenderPerBatch: shouldLoop ? loopRenderAll ? displayCount : 3 : 3,
315
+ windowSize: shouldLoop ? loopRenderAll ? displayCount : 7 : 5,
316
+ pagingEnabled: true,
317
+ snapToInterval: mainSize,
747
318
  decelerationRate: "fast",
748
- scrollEnabled: enabledState && touchable && count > 1,
749
- pagingEnabled: false,
750
- nestedScrollEnabled: preventScroll === false,
751
- directionalLockEnabled: preventScroll !== false,
752
- collapsable: false,
753
319
  showsHorizontalScrollIndicator: false,
754
320
  showsVerticalScrollIndicator: false,
755
- bounces: rubberband && !shouldLoop,
756
- scrollEventThrottle: 16,
757
321
  onScrollBeginDrag: handleScrollBeginDrag,
322
+ onScroll: handleScroll,
323
+ scrollEventThrottle: 16,
758
324
  onScrollEndDrag: handleScrollEndDrag,
759
325
  onMomentumScrollBegin: handleMomentumScrollBegin,
760
326
  onMomentumScrollEnd: handleScrollEnd,
761
- onScroll: handleScroll,
762
- initialScrollIndex: getInitialIndex(),
763
327
  onScrollToIndexFailed: info => {
764
- nativeMomentumRef.current = false;
765
- isScrollingRef.current = false;
766
- (0, _utils.runAfterFrames)(2, () => {
767
- try {
768
- isScrollingRef.current = true;
769
- scrollToIndexSafe(info.index, false);
770
- setCurrentSafe(info.index);
771
- } finally {
772
- isScrollingRef.current = false;
773
- const queued = nativeQueuedScrollRef.current;
774
- if (queued && flatListRef.current) {
775
- nativeQueuedScrollRef.current = null;
776
- const nextDisplayIndex = getDisplayIndex(queued.index);
777
- (0, _utils.runAfterFrames)(1, () => {
778
- swipeTo(nextDisplayIndex, queued.animated);
779
- });
780
- }
781
- }
782
- });
783
- },
784
- style: isWeb && {
785
- cursor: 'grab'
786
- } || undefined,
787
- contentContainerStyle: [isWeb && {
788
- userSelect: 'none'
789
- } || undefined, !isWeb && nativeTrackContentPaddingStyle || undefined],
790
- testID: `${testID}-flatlist`
328
+ scrollToDisplayIndex(info.index, false);
329
+ isAnimatingRef.current = false;
330
+ isInteractingRef.current = false;
331
+ updateIndex(getRealIndex(info.index));
332
+ scheduleAutoplay();
333
+ flushQueuedSwipe();
334
+ }
791
335
  }), /*#__PURE__*/_react().default.createElement(_reactNative().View, {
792
336
  pointerEvents: "none",
793
337
  style: styles.indicatorOverlay
@@ -800,13 +344,11 @@ const styles = _reactNative().StyleSheet.create({
800
344
  position: 'relative',
801
345
  overflow: 'hidden'
802
346
  },
803
- autoHeightChild: {
804
- flex: 0,
805
- width: '100%'
347
+ slide: {
348
+ flex: 1
806
349
  },
807
- webSlideWrapper: {
808
- flexShrink: 0,
809
- flexGrow: 0
350
+ item: {
351
+ flex: 1
810
352
  },
811
353
  indicatorOverlay: {
812
354
  position: 'absolute',
@@ -814,13 +356,8 @@ const styles = _reactNative().StyleSheet.create({
814
356
  right: 0,
815
357
  top: 0,
816
358
  bottom: 0,
817
- zIndex: 100,
818
- elevation: 100
359
+ zIndex: 10,
360
+ elevation: 10
819
361
  }
820
362
  });
821
- const webContainerStyle = _reactNative().Platform.OS === 'web' ? {
822
- cursor: 'grab',
823
- userSelect: 'none',
824
- WebkitUserSelect: 'none'
825
- } : undefined;
826
363
  var _default = exports.default = Swiper;