You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
## v3.5.0
2
+
* Add the ability to render either a `ScrollView` component or a `FlatList` one (default) ([see prop `useScrollView`](https://github.com/archriss/react-native-snap-carousel/#behavior))
3
+
* Add support for versions of React Native < `0.43` (see [this note](https://github.com/archriss/react-native-snap-carousel/#react-native-version))
4
+
* Add support for custom animations ([see props `customAnimationType` and `customAnimationOptions`](https://github.com/archriss/react-native-snap-carousel/#style-and-animation))
5
+
* Add method [`triggerRenderingHack()`](https://github.com/archriss/react-native-snap-carousel/#available-methods) to work around [a random `FlatList` bug](https://github.com/facebook/react-native/issues/1831) that keeps content hidden until the carousel is scrolled
6
+
* Hack around `ScrollView`/`FlatList` image rendering issues on Android
7
+
* Fix issue with tappable dots when loop is enabled
8
+
1
9
## v3.4.0
2
10
* Fix `snapToItem` call that results in snapping to the wrong item when `loop` is enabled
3
11
* Fix issue that, in some use cases, prevents every items but the initial ones to be rendered
`activeSlideOffset` | From slider's center, minimum slide distance to be scrolled before being set to active. | Number | `20`
191
-
`apparitionDelay` | `FlatList`'s init is a real mess, with lots of unneeded flickers and slides movement. This prop controls the delay during which the carousel will be hidden when mounted. | Number | `250`
191
+
`apparitionDelay` | `FlatList`'s init is a real mess, with lots of unneeded flickers and slides movement. This prop controls the delay during which the carousel will be hidden when mounted. **WARNING: on Android, using it may lead to [rendering issues](https://github.com/archriss/react-native-snap-carousel/issues/236) (i.e. images not showing up)**. Make sure to test thoroughly if you decide on using it. | Number | `0`
192
192
`callbackOffsetMargin` | Scroll events might not be triggered often enough to get a precise measure and, therefore, to provide a reliable callback. This usually is an Android issue, which might be linked to the version of React Native you're using (see ["Unreliable callbacks"](#unreliable-callbacks)). To work around this, you can define a small margin that will increase the "sweet spot"'s width. The default value should cover most cases, but **you will want to increase it if you experience missed callbacks**. | Number | `5`
193
193
`enableMomentum` | See [momentum](#momentum) | Boolean | `false`
194
194
`enableSnap` | If enabled, releasing the touch will scroll to the center of the nearest/active item | Boolean | `true`
`lockScrollWhileSnapping` | Prevent the user from swiping again while the carousel is snapping to a position. This prevents miscellaneous minor issues (inadvertently tapping an item while scrolling, stopping the scrolling animation if the carousel is tapped in the middle of a snap, clunky behavior on Android when short snapping quickly in opposite directions). The only drawback is that enabling the prop hinders the ability to swipe quickly between items as a little pause between swipes is needed. **Note that the prop won't have any effect if `enableMomentum` is set to `true`, since it would otherwise impede the natural and expected behavior.** | Boolean | `false`
198
198
`shouldOptimizeUpdates` | Whether to implement a `shouldComponentUpdate` strategy to minimize updates | Boolean | `true`
199
199
`swipeThreshold` | Delta x when swiping to trigger the snap | Number | `20`
200
+
`useScrollView` | Whether to use a `ScrollView` component instead of the default `FlatList` one. The advantages are to avoid rendering issues that can arise with `FlatList` and to provide compatibility with React Native pre- `0.43`. The major drawback is that you won't benefit from any of `FlatList`'s advanced optimizations. **We recommend activating it only with a small set of slides and to test performance thoroughly in production mode.** | Boolean | `false`
`activeSlideAlignment` | Determine active slide's alignment relative to the carousel. Possible values are: `'start'`, `'center'` and `'end'`. | String | `'center'`
222
223
`containerCustomStyle` | Optional styles for Scrollview's global wrapper | View Style Object | `{}`
`customAnimationOptions` | Custom animation options. Note that `useNativeDriver` will be enabled by default and that opacity's easing will always be kept linear. **Setting this prop to something other than `null` will trigger custom animations and will completely change the way items are animated**: rather than having their opacity and scale interpolated based the scroll value (default behavior), they will now play the custom animation you provide as soon as they become active. | Object | `null`
226
+
`customAnimationType` | Custom [animation type](https://facebook.github.io/react-native/docs/animated.html#configuring-animations): either `'decay`, `'spring'` or `'timing'`. Note that it will only be applied to the scale animation since opacity's animation type will always be set to `timing` (no one wants the opacity to 'bounce' around). | String | `'timing'`
224
227
`inactiveSlideOpacity` | Value of the opacity effect applied to inactive slides | Number | `0.7`
225
228
`inactiveSlideScale` | Value of the 'scale' transform applied to inactive slides | Number | `0.9`
226
-
`inactiveSlideShift` | Value of the 'translate' transform applied to inactive slides (see [#204](https://github.com/archriss/react-native-snap-carousel/issues/204) for an example usage) | Number | `0`
229
+
`inactiveSlideShift` | Value of the 'translate' transform applied to inactive slides (see [#204](https://github.com/archriss/react-native-snap-carousel/issues/204) for an example usage). **It is not recommended to use this prop in conjunction with `customItemAnimationOptions`**. | Number | `0`
227
230
`slideStyle` | Optional style for each item's container (the one whose scale and opacity are animated) | Animated View Style Object | `{}`
228
231
229
232
### Callbacks
@@ -281,6 +284,7 @@ Method | Description
281
284
`snapToItem (index, animated = true)` | Snap to an item manually
282
285
`snapToNext (animated = true)` | Snap to next item manually
283
286
`snapToPrev (animated = true)` | Snap to previous item manually
287
+
`triggerRenderingHack (offset)` | Call this when needed to work around [a random `FlatList` bug](https://github.com/facebook/react-native/issues/1831) that keeps content hidden until the carousel is scrolled. Note that the `offset` parameter is not required and will default to either `1` or `-1` depending on the current scroll position.
284
288
285
289
## Getters
286
290
@@ -439,7 +443,7 @@ export class MyCarousel extends Component {
439
443
440
444
**If you are using the plugin without the preview effect (meaning that your slides, as well as your slider, are viewport wide), we do not recommend using this plugin.**
441
445
442
-
You'll be better off with [`react-native-swiper](https://github.com/leecade/react-native-swiper) for the simple reason that it implements the `ViewPagerAndroid` component, which provides a way better overall feeling on Android, whereas we must hack our way around [the miscellaneous `ScrollView` limitations](#flatlist-and-scrollviews-limitations).
446
+
You'll be better off with [`react-native-swiper`](https://github.com/leecade/react-native-swiper) for the simple reason that it implements the `ViewPagerAndroid` component, which provides a way better overall feeling on Android, whereas we must hack our way around [the frustrating limitations of the `ScrollView`component](#flatlist-and-scrollviews-limitations).
443
447
444
448
### Understanding styles
445
449
@@ -524,7 +528,7 @@ Remember that every vote counts and take a look at [#203](https://github.com/arc
524
528
525
529
### React Native version
526
530
527
-
:warning:**RN0.43.x is the minimum required to use versions `>= 3.0.0`ofthe plugin. Ifyou're using an older release of React Native, you are stuck with version `2.4.0`. Please note that we won't support this older version of the plugin.**Also, make sure to check [the relevant documentation](https://github.com/archriss/react-native-snap-carousel/blob/v2.4.0/README.md).
531
+
:warning: **RN 0.43.x is the minimum recommended version for plugin releases `>=3.0.0`since it was the first version to introduce the `FlatList` component.** Since version `3.5.0`, the component will fall back to rendering a `ScrollView` if you're using an older version of React Native (mirroring the effect of setting prop `useScrollView` to `true`). **But keep in mind that the `ScrollView` component is not suited to render huge number of items.** If you experience performance issues, consider updating your React Native version and using the default `FlatList` version.
528
532
529
533
Bear in mind that we follow RN evolutions closely, which means newer versions of the plugin might break when used in conjunction with a version of RN that is not the latest stable one.
530
534
@@ -569,15 +573,18 @@ Note that you may want to reverse the order of your data array for your items to
569
573
## Roadmap
570
574
571
575
- [ ] Add more examples
576
+
- [ ] Handle different items' width/height
572
577
- [ ] Implement a custom `PanResponder`for better control over carousel's callbacks and overall feeling
578
+
- [X] Implement both `FlatList` and `ScrollView` handling
579
+
- [X] Add the ability to provide custom items animation
573
580
- [X] Implement 'loop' mode
574
581
- [X] Improve Android's behavior
575
582
- [x] Add parallax image component
576
583
- [x] Base the plugin on `FlatList` instead of`ScrollView`
577
584
- [x] Add alignment option
578
585
- [x] Add pagination component
579
586
- [x] Add vertical implementation
580
-
- [x] Handle device orientation event (see [this note](https://github.com/archriss/react-native-snap-carousel#handling-device-rotation))
587
+
- [x] Handle device orientation event (see [this note](https://github.com/archriss/react-native-snap-carousel#handling-device-rotation))
0 commit comments