react-native-reanimated-carousel 1.2.0-beta.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +324 -0
  2. package/README.md +59 -89
  3. package/README.zh-CN.md +57 -86
  4. package/lib/commonjs/Carousel.js +95 -177
  5. package/lib/commonjs/Carousel.js.map +1 -1
  6. package/lib/commonjs/ScrollViewGesture.js +16 -8
  7. package/lib/commonjs/ScrollViewGesture.js.map +1 -1
  8. package/lib/commonjs/constants/index.js +14 -0
  9. package/lib/commonjs/constants/index.js.map +1 -0
  10. package/lib/commonjs/hooks/useAutoPlay.js +21 -12
  11. package/lib/commonjs/hooks/useAutoPlay.js.map +1 -1
  12. package/lib/commonjs/hooks/useCarouselController.js +56 -13
  13. package/lib/commonjs/hooks/useCarouselController.js.map +1 -1
  14. package/lib/commonjs/hooks/useCommonVariables.js +37 -0
  15. package/lib/commonjs/hooks/useCommonVariables.js.map +1 -0
  16. package/lib/commonjs/hooks/useIndexController.js +7 -3
  17. package/lib/commonjs/hooks/useIndexController.js.map +1 -1
  18. package/lib/commonjs/hooks/useInitProps.js +67 -0
  19. package/lib/commonjs/hooks/useInitProps.js.map +1 -0
  20. package/lib/commonjs/hooks/useLayoutConfig.js +40 -0
  21. package/lib/commonjs/hooks/useLayoutConfig.js.map +1 -0
  22. package/lib/commonjs/hooks/useOffsetX.js.map +1 -1
  23. package/lib/commonjs/hooks/useOnProgressChange.js +39 -0
  24. package/lib/commonjs/hooks/useOnProgressChange.js.map +1 -0
  25. package/lib/commonjs/hooks/usePropsErrorBoundary.js +3 -2
  26. package/lib/commonjs/hooks/usePropsErrorBoundary.js.map +1 -1
  27. package/lib/commonjs/{CarouselItem.js → layouts/BaseLayout.js} +47 -30
  28. package/lib/commonjs/layouts/BaseLayout.js.map +1 -0
  29. package/lib/commonjs/layouts/ParallaxLayout.js +5 -7
  30. package/lib/commonjs/layouts/ParallaxLayout.js.map +1 -1
  31. package/lib/commonjs/layouts/index.js +13 -14
  32. package/lib/commonjs/layouts/index.js.map +1 -1
  33. package/lib/commonjs/layouts/normal.js +28 -0
  34. package/lib/commonjs/layouts/normal.js.map +1 -0
  35. package/lib/commonjs/layouts/parallax.js +37 -0
  36. package/lib/commonjs/layouts/parallax.js.map +1 -0
  37. package/lib/commonjs/layouts/stack.js +205 -0
  38. package/lib/commonjs/layouts/stack.js.map +1 -0
  39. package/lib/commonjs/store/index.js +15 -0
  40. package/lib/commonjs/store/index.js.map +1 -0
  41. package/lib/module/Carousel.js +88 -168
  42. package/lib/module/Carousel.js.map +1 -1
  43. package/lib/module/ScrollViewGesture.js +14 -8
  44. package/lib/module/ScrollViewGesture.js.map +1 -1
  45. package/lib/module/constants/index.js +7 -0
  46. package/lib/module/constants/index.js.map +1 -0
  47. package/lib/module/hooks/useAutoPlay.js +21 -12
  48. package/lib/module/hooks/useAutoPlay.js.map +1 -1
  49. package/lib/module/hooks/useCarouselController.js +53 -14
  50. package/lib/module/hooks/useCarouselController.js.map +1 -1
  51. package/lib/module/hooks/useCommonVariables.js +24 -0
  52. package/lib/module/hooks/useCommonVariables.js.map +1 -0
  53. package/lib/module/hooks/useIndexController.js +7 -3
  54. package/lib/module/hooks/useIndexController.js.map +1 -1
  55. package/lib/module/hooks/useInitProps.js +55 -0
  56. package/lib/module/hooks/useInitProps.js.map +1 -0
  57. package/lib/module/hooks/useLayoutConfig.js +29 -0
  58. package/lib/module/hooks/useLayoutConfig.js.map +1 -0
  59. package/lib/module/hooks/useOffsetX.js.map +1 -1
  60. package/lib/module/hooks/useOnProgressChange.js +30 -0
  61. package/lib/module/hooks/useOnProgressChange.js.map +1 -0
  62. package/lib/module/hooks/usePropsErrorBoundary.js +3 -2
  63. package/lib/module/hooks/usePropsErrorBoundary.js.map +1 -1
  64. package/lib/module/layouts/BaseLayout.js +71 -0
  65. package/lib/module/layouts/BaseLayout.js.map +1 -0
  66. package/lib/module/layouts/ParallaxLayout.js +5 -6
  67. package/lib/module/layouts/ParallaxLayout.js.map +1 -1
  68. package/lib/module/layouts/index.js +9 -2
  69. package/lib/module/layouts/index.js.map +1 -1
  70. package/lib/module/layouts/normal.js +20 -0
  71. package/lib/module/layouts/normal.js.map +1 -0
  72. package/lib/module/layouts/parallax.js +29 -0
  73. package/lib/module/layouts/parallax.js.map +1 -0
  74. package/lib/module/layouts/stack.js +193 -0
  75. package/lib/module/layouts/stack.js.map +1 -0
  76. package/lib/module/store/index.js +3 -0
  77. package/lib/module/store/index.js.map +1 -0
  78. package/lib/typescript/Carousel.d.ts +1 -1
  79. package/lib/typescript/ScrollViewGesture.d.ts +3 -9
  80. package/lib/typescript/constants/index.d.ts +4 -0
  81. package/lib/typescript/hooks/useCarouselController.d.ts +10 -2
  82. package/lib/typescript/hooks/useCommonVariables.d.ts +9 -0
  83. package/lib/typescript/hooks/useIndexController.d.ts +1 -0
  84. package/lib/typescript/hooks/useInitProps.d.ts +8 -0
  85. package/lib/typescript/hooks/useLayoutConfig.d.ts +7 -0
  86. package/lib/typescript/hooks/useOffsetX.d.ts +1 -2
  87. package/lib/typescript/hooks/useOnProgressChange.d.ts +6 -0
  88. package/lib/typescript/layouts/BaseLayout.d.ts +11 -0
  89. package/lib/typescript/layouts/ParallaxLayout.d.ts +3 -5
  90. package/lib/typescript/layouts/index.d.ts +10 -3
  91. package/lib/typescript/layouts/normal.d.ts +12 -0
  92. package/lib/typescript/layouts/parallax.d.ts +33 -0
  93. package/lib/typescript/layouts/stack.d.ts +12 -0
  94. package/lib/typescript/store/index.d.ts +10 -0
  95. package/lib/typescript/types.d.ts +25 -42
  96. package/package.json +141 -127
  97. package/src/Carousel.tsx +99 -216
  98. package/src/ScrollViewGesture.tsx +17 -25
  99. package/src/constants/index.ts +4 -0
  100. package/src/hooks/useAutoPlay.ts +29 -15
  101. package/src/hooks/useCarouselController.tsx +83 -28
  102. package/src/hooks/useCommonVariables.ts +29 -0
  103. package/src/hooks/useIndexController.ts +13 -1
  104. package/src/hooks/useInitProps.ts +66 -0
  105. package/src/hooks/useLayoutConfig.ts +26 -0
  106. package/src/hooks/useOffsetX.ts +1 -1
  107. package/src/hooks/useOnProgressChange.ts +39 -0
  108. package/src/hooks/usePropsErrorBoundary.ts +3 -1
  109. package/src/{CarouselItem.tsx → layouts/BaseLayout.tsx} +42 -32
  110. package/src/layouts/ParallaxLayout.tsx +16 -20
  111. package/src/layouts/index.tsx +11 -3
  112. package/src/layouts/normal.ts +27 -0
  113. package/src/layouts/parallax.ts +71 -0
  114. package/src/layouts/stack.ts +315 -0
  115. package/src/store/index.ts +12 -0
  116. package/src/types.ts +42 -55
  117. package/lib/commonjs/CarouselItem.js.map +0 -1
  118. package/lib/commonjs/layouts/StackLayout.js +0 -190
  119. package/lib/commonjs/layouts/StackLayout.js.map +0 -1
  120. package/lib/module/CarouselItem.js +0 -55
  121. package/lib/module/CarouselItem.js.map +0 -1
  122. package/lib/module/layouts/StackLayout.js +0 -165
  123. package/lib/module/layouts/StackLayout.js.map +0 -1
  124. package/lib/typescript/CarouselItem.d.ts +0 -13
  125. package/lib/typescript/layouts/StackLayout.d.ts +0 -24
  126. package/src/layouts/StackLayout.tsx +0 -361
package/CHANGELOG.md ADDED
@@ -0,0 +1,324 @@
1
+ # [2.0.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.2.0-beta.4...v2.0.0) (2022-01-07)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix bug from refactoring ([c77f4d8](https://github.com/dohooo/react-native-reanimated-carousel/commit/c77f4d8604e319528f2d15fd288734749615e077))
7
+
8
+ # [1.2.0-beta.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.2.0-beta.3...v1.2.0-beta.4) (2022-01-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * solve a bug caused by Parallax/Normal layout reconstruction ([651bf5e](https://github.com/dohooo/react-native-reanimated-carousel/commit/651bf5ee0572f512dddc01205dbb74d651cfa0ce))
14
+
15
+ # [1.2.0-beta.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2022-01-05)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * fix bug with windowSize props ([b9637ca](https://github.com/dohooo/react-native-reanimated-carousel/commit/b9637ca4f988851c6f0636e50c8079837eda42f6)), closes [#71](https://github.com/dohooo/react-native-reanimated-carousel/issues/71)
21
+ * onProgressChange/onSnapToItem props wrong calculation ([85de2f4](https://github.com/dohooo/react-native-reanimated-carousel/commit/85de2f41935e299ff7510e5b678e0f37fc29d13e)), closes [#74](https://github.com/dohooo/react-native-reanimated-carousel/issues/74)
22
+
23
+
24
+ ### Features
25
+
26
+ * support to RTL ([c2c3bcf](https://github.com/dohooo/react-native-reanimated-carousel/commit/c2c3bcfd2fe475b9934962d62e97bc39bf8fdf2d)), closes [#69](https://github.com/dohooo/react-native-reanimated-carousel/issues/69)
27
+
28
+
29
+
30
+ # [1.1.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2022-01-03)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * _ ([c8054f1](https://github.com/dohooo/react-native-reanimated-carousel/commit/c8054f17202e7ff33447cd70e83582f4914941ad))
36
+ * fix item blink when scroll active ([96c9b75](https://github.com/dohooo/react-native-reanimated-carousel/commit/96c9b751a7ee4cc0ba013801d098b05705c26bcf))
37
+ * fix with zindex ([f3b28cc](https://github.com/dohooo/react-native-reanimated-carousel/commit/f3b28cc8a83649a885307b82908e714bb2724ab4))
38
+ * item blink ([063f564](https://github.com/dohooo/react-native-reanimated-carousel/commit/063f5644779f37754608972507b10d0cfb87769a))
39
+ * item zIndex ([10e58a8](https://github.com/dohooo/react-native-reanimated-carousel/commit/10e58a876e8cb386a45d17ea8eb8bee79de0e94a))
40
+ * refactor stack layout ([dc975fe](https://github.com/dohooo/react-native-reanimated-carousel/commit/dc975fe8f25b03b59047fd21f596d626f806de2b))
41
+
42
+
43
+ ### Features
44
+
45
+ * add stack layout ([5a70a23](https://github.com/dohooo/react-native-reanimated-carousel/commit/5a70a230307e0b258e16230d6b21be2c4d8c7497))
46
+ * multiple stack styles are supported ([d4497a7](https://github.com/dohooo/react-native-reanimated-carousel/commit/d4497a785f6da4dae79e812dac1d5515303d0cd3))
47
+ * support pagingEnabled enableSnap ([000658e](https://github.com/dohooo/react-native-reanimated-carousel/commit/000658ed4a97b58d4e2649b6ab816e62919beff9)), closes [#65](https://github.com/dohooo/react-native-reanimated-carousel/issues/65)
48
+
49
+
50
+
51
+ ## [1.0.12](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-28)
52
+
53
+
54
+ ### Bug Fixes
55
+
56
+ * scroll pass the last item ([34a5e57](https://github.com/dohooo/react-native-reanimated-carousel/commit/34a5e5796a35f62374761bf2144a86f69acc8e66)), closes [#63](https://github.com/dohooo/react-native-reanimated-carousel/issues/63)
57
+
58
+
59
+
60
+ ## [1.0.11](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-20)
61
+
62
+
63
+ ### Bug Fixes
64
+
65
+ * fixed useAnimatedReaction wrong import ([7b7a3fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/7b7a3fc4f49b5f3bfff664b2c07306334ac2e509))
66
+
67
+
68
+
69
+ ## [1.0.10](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-19)
70
+
71
+
72
+ ### Bug Fixes
73
+
74
+ * fix ScrollViewGesture callback ([40412fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/40412fcab6c1e6e013ccd8c409c2fb9bffcde926))
75
+ * fixed failure to set default values ([5d02779](https://github.com/dohooo/react-native-reanimated-carousel/commit/5d0277925a0daf00944e7900d86f3ee463f77719))
76
+ * fixed types ([9f3068b](https://github.com/dohooo/react-native-reanimated-carousel/commit/9f3068bbb9dadbdd046ad50cf4437b53f335e4a9))
77
+ * modify useCarouselController params ([c8f2c6a](https://github.com/dohooo/react-native-reanimated-carousel/commit/c8f2c6acb9b578fa38d365c669aaf2beb6694686))
78
+
79
+
80
+ ### Features
81
+
82
+ * add babel-loader in example,support to web ([1edc9c3](https://github.com/dohooo/react-native-reanimated-carousel/commit/1edc9c34a7a02e35fa6c18927d8b543367bb1c30))
83
+ * add examples ([666ba86](https://github.com/dohooo/react-native-reanimated-carousel/commit/666ba86729105bb825f95a9dbdc4290efbd3dffa))
84
+ * add navigation in example ([1687f1d](https://github.com/dohooo/react-native-reanimated-carousel/commit/1687f1db4c98e583f29326dc1b2a273adb19af4e))
85
+ * add ScrollViewGesture ([a903f12](https://github.com/dohooo/react-native-reanimated-carousel/commit/a903f12d73a18c2774318154544dda17c755f6ff))
86
+ * lazy loading ([ed75232](https://github.com/dohooo/react-native-reanimated-carousel/commit/ed75232eb25a475f994f327e94f9dd717b9cf251))
87
+ * springConfig props has be deprecated ([763c073](https://github.com/dohooo/react-native-reanimated-carousel/commit/763c07398f196391ebf478ebd9c45acd7c6890a3))
88
+ * vertical mode ([7645b75](https://github.com/dohooo/react-native-reanimated-carousel/commit/7645b753f9379cb86bba27764a99cd163a744570)), closes [#41](https://github.com/dohooo/react-native-reanimated-carousel/issues/41)
89
+
90
+
91
+ ### Performance Improvements
92
+
93
+ * add example ([1684038](https://github.com/dohooo/react-native-reanimated-carousel/commit/16840383712eda31b1a8481fa5498ed9b92504cd))
94
+ * add example ([8527ffb](https://github.com/dohooo/react-native-reanimated-carousel/commit/8527ffbd2b374f880a42d445a24c385c18885859))
95
+ * lazy loading ([39ba773](https://github.com/dohooo/react-native-reanimated-carousel/commit/39ba7735946326c10dd5ec8b6ffe6a8fcf9a8006))
96
+
97
+
98
+
99
+ ## [1.0.9](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-07)
100
+
101
+
102
+ ### Performance Improvements
103
+
104
+ * add props 'windowSize' ([4e066ee](https://github.com/dohooo/react-native-reanimated-carousel/commit/4e066eed5a3d3eb9cc4a9d1173831a44385bac65)), closes [#46](https://github.com/dohooo/react-native-reanimated-carousel/issues/46)
105
+ * reduce the calculation of animation values ([de32274](https://github.com/dohooo/react-native-reanimated-carousel/commit/de322745d900251614e25005fe39dd32fab4e9a7)), closes [#46](https://github.com/dohooo/react-native-reanimated-carousel/issues/46)
106
+
107
+
108
+
109
+ ## [1.0.8](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-06)
110
+
111
+
112
+ ### Bug Fixes
113
+
114
+ * fix items position ([6d36555](https://github.com/dohooo/react-native-reanimated-carousel/commit/6d365550b677513c3b56ed3a401dbf021a0d2856)), closes [#51](https://github.com/dohooo/react-native-reanimated-carousel/issues/51)
115
+
116
+
117
+
118
+ ## [1.0.7](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-12-05)
119
+
120
+
121
+ ### Bug Fixes
122
+
123
+ * a quick call to the page number switch method causes an offset error ([0c93b86](https://github.com/dohooo/react-native-reanimated-carousel/commit/0c93b867f4e17583b08683404a36590fc267c03c)), closes [#30](https://github.com/dohooo/react-native-reanimated-carousel/issues/30)
124
+ * defaultIndex does not work as expected ([42e4616](https://github.com/dohooo/react-native-reanimated-carousel/commit/42e46166144ceac6b15c6ad4e7d18923a722f91b)), closes [#33](https://github.com/dohooo/react-native-reanimated-carousel/issues/33)
125
+ * fix computed error with MAX/MIN ([e9a3007](https://github.com/dohooo/react-native-reanimated-carousel/commit/e9a30070dbae04a889015be05aff398079f35e84))
126
+ * image flickers within Carousel when state is updated ([094f3af](https://github.com/dohooo/react-native-reanimated-carousel/commit/094f3af65b517f59d2982d3dcfc64dab1404fcc5)), closes [#32](https://github.com/dohooo/react-native-reanimated-carousel/issues/32)
127
+ * modify useOffsetX viewCount default value ([dd30b9c](https://github.com/dohooo/react-native-reanimated-carousel/commit/dd30b9c0ec52917eeb1d0a144e46318a1bae7da8))
128
+ * sliding error with no loop ([955b5ed](https://github.com/dohooo/react-native-reanimated-carousel/commit/955b5ede0d975231feab55258823a9538752c0e2)), closes [#24](https://github.com/dohooo/react-native-reanimated-carousel/issues/24)
129
+
130
+
131
+
132
+ ## [1.0.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-18)
133
+
134
+
135
+ ### Bug Fixes
136
+
137
+ * **hooks/usepropserrorboundary.ts:** always be error when data props set null ([2450fe1](https://github.com/dohooo/react-native-reanimated-carousel/commit/2450fe120b22ec561a3bc7c4b687ccfee0bfc080)), closes [#34](https://github.com/dohooo/react-native-reanimated-carousel/issues/34)
138
+
139
+
140
+
141
+ ## [1.0.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-10)
142
+
143
+
144
+ ### Features
145
+
146
+ * add defaultIndex props ([e9191f9](https://github.com/dohooo/react-native-reanimated-carousel/commit/e9191f96dab5885ca14bc873b5feeb6fa80ac82a)), closes [#31](https://github.com/dohooo/react-native-reanimated-carousel/issues/31)
147
+
148
+
149
+
150
+ ## [1.0.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-03)
151
+
152
+
153
+ ### Features
154
+
155
+ * add onProgressChange props ([a3894ff](https://github.com/dohooo/react-native-reanimated-carousel/commit/a3894ffb64d2541e61683d06c53487dc54af1a47))
156
+
157
+
158
+
159
+ ## [1.0.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-11-01)
160
+
161
+
162
+ ### Bug Fixes
163
+
164
+ * fix bug with reanimated ([6744f74](https://github.com/dohooo/react-native-reanimated-carousel/commit/6744f747424d6ad51e61bca0702eec8e60d00441))
165
+
166
+
167
+
168
+ # [1.0.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-31)
169
+
170
+
171
+ ### Bug Fixes
172
+
173
+ * fix default timeConfig ([0f99500](https://github.com/dohooo/react-native-reanimated-carousel/commit/0f9950005604fa19ff73449a58b3944bd4f1fee2))
174
+ * solve sliding flicker problem ([96678e0](https://github.com/dohooo/react-native-reanimated-carousel/commit/96678e0d3c03ea6f6bc9a40534c1bb732475e102))
175
+ * solve sliding flicker problem ([e26c384](https://github.com/dohooo/react-native-reanimated-carousel/commit/e26c384f25b203a420f7bed2c356586cb1466f65))
176
+ * upgrade expo sdk 40 to 41. fix example error ([11b39b1](https://github.com/dohooo/react-native-reanimated-carousel/commit/11b39b16f682551ad1b2b67e497ea0709d7b7766))
177
+
178
+
179
+ ### Features
180
+
181
+ * improve sliding experience ([14b62ee](https://github.com/dohooo/react-native-reanimated-carousel/commit/14b62ee3ae63bfff693891c1bfc0fa39278e2ed3))
182
+
183
+
184
+ ### BREAKING CHANGES
185
+
186
+ * remove props "timingConfig", add "springConfig" with no support of duration
187
+
188
+
189
+
190
+ ## [0.5.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-27)
191
+
192
+
193
+ ### Bug Fixes
194
+
195
+ * onSnapToItem gives floating index ([13d6c64](https://github.com/dohooo/react-native-reanimated-carousel/commit/13d6c6485f4fa54bf944b10947f928b2cf88c7b7)), closes [#13](https://github.com/dohooo/react-native-reanimated-carousel/issues/13)
196
+
197
+
198
+
199
+ ## [0.5.3-beta.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-27)
200
+
201
+
202
+ ### Bug Fixes
203
+
204
+ * drag issues occur when auto-scrolling ([ebb0ce2](https://github.com/dohooo/react-native-reanimated-carousel/commit/ebb0ce20d35b134755b163ea9ffc0e85daffdb9c)), closes [#13](https://github.com/dohooo/react-native-reanimated-carousel/issues/13)
205
+
206
+
207
+
208
+ ## [0.5.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-19)
209
+
210
+
211
+
212
+ ## [0.5.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-09)
213
+
214
+
215
+ ### Features
216
+
217
+ * add onScrollBegin/onScrollEnd props ([3180696](https://github.com/dohooo/react-native-reanimated-carousel/commit/31806966ca644d086bfea7a872108b1006e50ecf))
218
+
219
+
220
+
221
+ # [0.5.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-10-08)
222
+
223
+
224
+ ### Bug Fixes
225
+
226
+ * fix onSnapToItem no call when auto playing ([4953b98](https://github.com/dohooo/react-native-reanimated-carousel/commit/4953b9805beb5a591ee0b261c81c7dd623337a75))
227
+ * onSnapToItem not called if loop={false} ([1ce57f4](https://github.com/dohooo/react-native-reanimated-carousel/commit/1ce57f4e0201c2d50a1ce754f08b6afb5661a6a1))
228
+
229
+
230
+ ### Features
231
+
232
+ * add goToIndex method ([b33bb78](https://github.com/dohooo/react-native-reanimated-carousel/commit/b33bb788e5849615b5c90b122633507ec0f2bfbf))
233
+
234
+
235
+
236
+ ## [0.4.4](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-30)
237
+
238
+
239
+ ### Bug Fixes
240
+
241
+ * fix animation bug ([d3b6831](https://github.com/dohooo/react-native-reanimated-carousel/commit/d3b683169cca9fba3083b52133758a7a39dcf25e))
242
+
243
+
244
+
245
+ ## [0.4.3](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-09)
246
+
247
+
248
+ ### Bug Fixes
249
+
250
+ * sliding causes problems with sliding errors when auto playing ([37f6565](https://github.com/dohooo/react-native-reanimated-carousel/commit/37f656539fed21f5a7d4148af02954b97f95a7f7))
251
+
252
+
253
+
254
+ ## [0.4.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-09)
255
+
256
+
257
+ ### Bug Fixes
258
+
259
+ * fixed scrolling on Android ([d253b3c](https://github.com/dohooo/react-native-reanimated-carousel/commit/d253b3cc30538a2702dceeb2be37c99fb2ee2d67))
260
+
261
+
262
+
263
+ ## [0.4.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
264
+
265
+
266
+ ### Bug Fixes
267
+
268
+ * handles boundary cases for raw data ([4386bfd](https://github.com/dohooo/react-native-reanimated-carousel/commit/4386bfd59553c2df53c3987c539e299fac52a491))
269
+
270
+
271
+
272
+ # [0.4.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
273
+
274
+
275
+ ### Features
276
+
277
+ * add onSnapToItem props,should get current item info ([6ae05fc](https://github.com/dohooo/react-native-reanimated-carousel/commit/6ae05fcaa382c4b406d135c66bebdaa614c07b67))
278
+
279
+
280
+
281
+ ## [0.3.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
282
+
283
+
284
+ ### Bug Fixes
285
+
286
+ * after data props update carousel not be can swipe ([dd00932](https://github.com/dohooo/react-native-reanimated-carousel/commit/dd00932b65df0e7efdc10e4f4e72cf8da5ca8456))
287
+
288
+
289
+
290
+ # [0.3.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-08)
291
+
292
+
293
+ ### Features
294
+
295
+ * add loop props,control wheter loop playback ([97cf2b9](https://github.com/dohooo/react-native-reanimated-carousel/commit/97cf2b99c9279fc65da323e35b3461bc1df64b15))
296
+
297
+
298
+
299
+ ## [0.2.2](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
300
+
301
+
302
+
303
+ ## [0.2.1](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
304
+
305
+
306
+ ### Bug Fixes
307
+
308
+ * fix calculation errors ([15b2119](https://github.com/dohooo/react-native-reanimated-carousel/commit/15b21192b510902e833900b5fc44affd78941614))
309
+
310
+
311
+
312
+ # [0.2.0](https://github.com/dohooo/react-native-reanimated-carousel/compare/v1.1.0...v1.2.0-beta.3) (2021-09-07)
313
+
314
+
315
+ ### Bug Fixes
316
+
317
+ * fix algorithm errors ([af61df8](https://github.com/dohooo/react-native-reanimated-carousel/commit/af61df8da51c56940449c4f1c50440f567e33c46))
318
+
319
+
320
+ ### Features
321
+
322
+ * export types ([2dcceb8](https://github.com/dohooo/react-native-reanimated-carousel/commit/2dcceb8001eff1b16c64399a4ca1b372ac9e8026))
323
+ * first commit of carousel component ([af964e3](https://github.com/dohooo/react-native-reanimated-carousel/commit/af964e331ae7b4363a407451344d9ffc1369b91f))
324
+
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  English | [简体中文](./README.zh-CN.md)
2
2
 
3
- # react-native-reanimated-carousel
3
+ # react-native-reanimated-carousel 2
4
4
 
5
5
  <img src="assets/banner.png" width="100%"/>
6
6
 
@@ -9,63 +9,54 @@ English | [简体中文](./README.zh-CN.md)
9
9
  [![npm](https://img.shields.io/npm/dm/react-native-reanimated-carousel.svg?style=flat-square&colorB=007ec6)](https://www.npmjs.com/package/react-native-reanimated-carousel)
10
10
  [![github issues](https://img.shields.io/github/issues/dohooo/react-native-reanimated-carousel.svg?style=flat-square)](https://github.com/dohooo/react-native-reanimated-carousel/issues)
11
11
  [![github closed issues](https://img.shields.io/github/issues-closed/dohooo/react-native-reanimated-carousel.svg?style=flat-square&colorB=44cc11)](https://github.com/dohooo/react-native-reanimated-carousel/issues?q=is%3Aissue+is%3Aclosed)
12
+ [![discord chat](https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord)](https://discord.gg/KsXRuDs43y)
12
13
 
13
- > Click on the image to see the demo. 🍺
14
+ ## ReactNative community's best use of the carousel component! 🎉🎉🎉
15
+
16
+ - **It completely solves this [problem](https://github.com/meliorence/react-native-snap-carousel/issues/632) for `react-native-snap-carousel`!**
17
+ - **Simple**、**Infinitely scrolling very smooth**、**Fully implemented using Reanimated 2!**
18
+
19
+ > V2 has been released! Joint it! [V1 docs](https://github.com/dohooo/react-native-reanimated-carousel/tree/v1.x.x)
20
+
21
+ > Click on the image to see the demo. [Try it(Snack)](https://snack.expo.dev/@zhaodonghao586/simple-carousel) 🍺
14
22
 
15
23
  <p align="center">
16
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/normal/index.tsx">
24
+ <a href="./example/src/normal/index.tsx">
17
25
  <img src="assets/normal-horizontal.gif" width="300"/>
18
26
  </a>
19
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/normal/index.tsx">
27
+ <a href="./example/src/normal/index.tsx">
20
28
  <img src="assets/normal-vertical.gif" width="300"/>
21
29
  </a>
22
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/parallax/index.tsx">
30
+ <a href="./example/src/parallax/index.tsx">
23
31
  <img src="assets/parallax-horizontal.gif" width="300"/>
24
32
  </a>
25
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/parallax/index.tsx">
33
+ <a href="./example/src/parallax/index.tsx">
26
34
  <img src="assets/parallax-vertical.gif" width="300"/>
27
35
  </a>
28
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/stack/index.tsx">
36
+ <a href="./example/src/stack/index.tsx">
29
37
  <img src="assets/stack-horizontal-left.gif" width="300"/>
30
38
  </a>
31
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/stack/index.tsx">
39
+ <a href="./example/src/stack/index.tsx">
32
40
  <img src="assets/stack-horizontal-right.gif" width="300"/>
33
41
  </a>
34
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/stack/index.tsx">
42
+ <a href="./example/src/stack/index.tsx">
35
43
  <img src="assets/stack-vertical-left.gif" width="300"/>
36
44
  </a>
37
- <a href="https://github.com/dohooo/react-native-reanimated-carousel/blob/main/example/src/stack/index.tsx">
45
+ <a href="./example/src/stack/index.tsx">
38
46
  <img src="assets/stack-vertical-right.gif" width="300"/>
39
47
  </a>
40
48
  </p>
41
49
 
42
50
  <br/>
43
51
 
44
- ## ReactNative community's best use of the carousel component! 🎉🎉🎉
45
-
46
- - It completely solves this [problem](https://github.com/meliorence/react-native-snap-carousel/issues/632) for `react-native-snap-carousel`! More styles and apis in development... [Try it](https://snack.expo.dev/@zhaodonghao586/simple-carousel)
47
- - **Simple**、**Infinitely scrolling very smooth**、**Fully implemented using Reanimated 2!**
48
-
49
- ## Reason
50
-
51
- <details>
52
- <summary>The common RN infinite scroll component. It get stuck on a fast slide. Wait for the next element to appear. This component will not have similar problems.Because using a completely different approach so the best performance is achieved.That's why this library was created.</summary>
53
- <p align="center">
54
- Use react-native-snap-carousel for quick swiping,you can see caton clearly when you reach the junction.(gif 4.6mb)
55
- </p>
56
- <p align="center">
57
- <img src="assets/react-native-snap-carousel.gif" width="50%"/>
58
- </p>
59
-
60
- <p align="center">
61
- Compared with react-native-reanimated-carousel,The actual test was ten slides per second, but it didn't show up very well in gif.
62
- </p>
63
- <p align="center">
64
- <img src="assets/normal-fast.gif" width="50%"/>
65
- </p>
66
- </details>
52
+ ## Table of contents
67
53
 
68
- ---
54
+ 1. [Installation](#Installation)
55
+ 1. [Usage](#Usage)
56
+ 1. [Props](./docs/props.md)
57
+ 1. [Tips](#Tips)
58
+ 1. [Reason](#Reason)
59
+ 1. [Example](#Example)
69
60
 
70
61
  ## Installation
71
62
 
@@ -83,65 +74,48 @@ npm install react-native-reanimated-carousel
83
74
 
84
75
  Now we need to install [`react-native-gesture-handler`](https://github.com/kmagiera/react-native-gesture-handler) and [`react-native-reanimated(>=2.0.0)`](https://github.com/kmagiera/react-native-reanimated).
85
76
 
86
- ## EXPO
87
-
88
- If use EXPO managed workflow please ensure that the version is greater than 41.Because the old version not support `Reanimated(v2)`
89
-
90
77
  ## Usage
91
78
 
92
79
  ```tsx
93
80
  import Carousel from 'react-native-reanimated-carousel';
94
81
 
95
- <Carousel<{ color: string }>
96
- width={width}
97
- data={[{ color: 'red' }, { color: 'purple' }, { color: 'yellow' }]}
98
- renderItem={({ color }) => {
99
- return <View style={{ backgroundColor: color, flex: 1 }} />;
100
- }}
82
+ <Carousel
83
+ width={300}
84
+ height={150}
85
+ data={[1, 2, 3]}
86
+ renderItem={(item) => <AnyElement />}
101
87
  />;
102
88
  ```
103
89
 
104
- ## Optimizing
105
-
106
- - When rendering a large number of elements, you can use the 'windowSize' property to control how many items of the current element are rendered. The default is full rendering. After testing without this property, frames will drop when rendering 200 empty views. After setting this property, rendering 1000 empty views is still smooth. (The specific number depends on the phone model tested)
107
-
108
- ## Props
109
-
110
- | name | required | default | types | description |
111
- | ----------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
112
- | data | ✅ | | T[] | Carousel items data set |
113
- | width | ✅ | | number | Specified carousel container width |
114
- | renderItem | ✅ | | (data: T, index: number) => React.ReactNode | Render carousel item |
115
- | defaultIndex | ❌ | 0 | number | Default index |
116
- | autoPlay | ❌ | false | boolean | Auto play |
117
- | autoPlayReverse | ❌ | false | boolean | Auto play reverse playback |
118
- | autoPlayInterval | ❌ | 1000 | autoPlayInterval | Auto play playback interval |
119
- | mode | ❌ | defalut | 'default'\|'stack'\|'parallax' | Carousel Animated transitions |
120
- | loop | ❌ | true | boolean | Carousel loop playback |
121
- | parallaxScrollingOffset | ❌ | 100 | number | When use 'parallax' Layout props,this prop can be control prev/next item offset |
122
- | parallaxScrollingScale | ❌ | 0.8 | number | When use 'parallax' Layout props,this prop can be control prev/next item scale |
123
- | style | ❌ | {} | ViewStyle | Carousel container style |
124
- | height | ❌ | '100%' | undefined \| string \| number | Specified carousel container height |
125
- | onSnapToItem | ❌ | | (index: number) => void | Callback fired when navigating to an item |
126
- | onScrollBegin | ❌ | | () => void | Callback fired when scroll begin |
127
- | onScrollEnd | ❌ | | (previous: number, current: number) => void | Callback fired when scroll end |
128
- | panGestureHandlerProps | ❌ | {} | Omit<Partial\<PanGestureHandlerProps\>,'onHandlerStateChange'> | PanGestureHandler props |
129
- | windowSize | ❌ | 0 | number | The maximum number of items that can respond to pan gesture events, `0` means all items will respond to pan gesture events |
130
- | onProgressChange | ❌ | | onProgressChange?: (offsetProgress: number,absoluteProgress: number) => void | On progress change. `offsetProgress`:Total of offset distance (0 390 780 ...); `absoluteProgress`:Convert to index (0 1 2 ...) |
131
- | vertical | ❌ | false | boolean | Layout items vertically instead of horizontally |
132
- | animationConfig | ❌ | { mode: 'vertical',snapDirection: 'left',moveSize: window.width,stackInterval: 30,scaleInterval: 0.08,rotateZDeg: 135} | {mode: 'vertical' \| 'horizontal';moveSize?: number;stackInterval?: number;scaleInterval?: number;rotateZDeg?: number;snapDirection?: 'left' \| 'right';} | Stack layout animation style |
133
- | showLength | ❌ | data.length - 1 | number | The maximum number of items will show in stack |
134
- | pagingEnabled | ❌ | true | boolean | When true, the scroll view stops on multiples of the scroll view's size when scrolling |
135
- | enableSnap | ❌ | true | boolean | If enabled, releasing the touch will scroll to the nearest item, valid when pagingEnabled=false |
136
-
137
- ## Ref
138
-
139
- | name | types | description |
140
- | --------------- | ------------------------------------------- | ---------------------- |
141
- | prev | ()=>void | Play the last one |
142
- | loop | ()=>void | Play the next one |
143
- | goToIndex | (index: number, animated?: boolean) => void | Go to index |
144
- | getCurrentIndex | ()=>number | Get current item index |
90
+ ## Tips
91
+
92
+ - Optimizing
93
+
94
+ - When rendering a large number of elements, you can use the 'windowSize' property to control how many items of the current element are rendered. The default is full rendering. After testing without this property, frames will drop when rendering 200 empty views. After setting this property, rendering 1000 empty views is still smooth. (The specific number depends on the phone model tested)
95
+
96
+ - RTL
97
+ - Support to RTL mode with no more configuration needed. But in RTL mode, need to manually set the autoPlayReverse props for autoplay to control scrolling direction.
98
+ - EXPO
99
+ - If use EXPO managed workflow please ensure that the version is greater than 41.Because the old version not support `Reanimated(v2)`.
100
+
101
+ ## Reason
102
+
103
+ <details>
104
+ <summary>The common RN infinite scroll component. It get stuck on a fast slide. Wait for the next element to appear. This component will not have similar problems.Because using a completely different approach so the best performance is achieved.That's why this library was created.</summary>
105
+ <p align="center">
106
+ Use react-native-snap-carousel for quick swiping,you can see caton clearly when you reach the junction.(gif 4.6mb)
107
+ </p>
108
+ <p align="center">
109
+ <img src="assets/react-native-snap-carousel.gif" width="50%"/>
110
+ </p>
111
+
112
+ <p align="center">
113
+ Compared with react-native-reanimated-carousel,The actual test was ten slides per second, but it didn't show up very well in gif.
114
+ </p>
115
+ <p align="center">
116
+ <img src="assets/normal-fast.gif" width="50%"/>
117
+ </p>
118
+ </details>
145
119
 
146
120
  ## Example
147
121
 
@@ -150,10 +124,6 @@ yarn example -- ios
150
124
  yarn example -- android
151
125
  ```
152
126
 
153
- ## Contributing
154
-
155
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
156
-
157
127
  ## License
158
128
 
159
129
  MIT