@momo-kits/carousel 0.0.59-beta.9 → 0.0.60-alpha.1

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 (2) hide show
  1. package/CarouselV2.js +12 -11
  2. package/package.json +1 -1
package/CarouselV2.js CHANGED
@@ -486,6 +486,7 @@ export default class Carousel extends React.PureComponent {
486
486
 
487
487
  _getSnapOffsets(props = this.props) {
488
488
  const offset = this._getItemMainDimension();
489
+ if (!props.enableSnap) return;
489
490
  return [...Array(this._getCustomDataLength(props))].map((_, i) => {
490
491
  return i * offset;
491
492
  });
@@ -1188,8 +1189,8 @@ export default class Carousel extends React.PureComponent {
1188
1189
  useExperimentalSnap,
1189
1190
  disableIntervalMomentum,
1190
1191
  vertical,
1192
+ enableSnap,
1191
1193
  } = this.props;
1192
-
1193
1194
  const containerStyle = [
1194
1195
  // { overflow: 'hidden' },
1195
1196
  containerCustomStyle || style || {},
@@ -1234,15 +1235,16 @@ export default class Carousel extends React.PureComponent {
1234
1235
  // - Slide animations will be off
1235
1236
  // - Last items won't be set as active (no `onSnapToItem` callback)
1236
1237
  // Recommended only with large slides and `activeSlideAlignment` set to `start` for the time being
1237
- const snapProps = useExperimentalSnap
1238
- ? {
1239
- disableIntervalMomentum, // Slide ± one item at a time
1240
- snapToAlignment: activeSlideAlignment,
1241
- snapToInterval: this._getItemMainDimension(),
1242
- }
1243
- : {
1244
- snapToOffsets: this._getSnapOffsets(),
1245
- };
1238
+ const snapProps =
1239
+ enableSnap && useExperimentalSnap
1240
+ ? {
1241
+ disableIntervalMomentum, // Slide ± one item at a time
1242
+ snapToAlignment: activeSlideAlignment,
1243
+ snapToInterval: this._getItemMainDimension(),
1244
+ }
1245
+ : {
1246
+ snapToOffsets: this._getSnapOffsets(),
1247
+ };
1246
1248
 
1247
1249
  // Flatlist specifics
1248
1250
  const specificProps = !this._needsScrollView()
@@ -1294,7 +1296,6 @@ export default class Carousel extends React.PureComponent {
1294
1296
  typeof useScrollView === 'function'
1295
1297
  ? useScrollView
1296
1298
  : Animated.ScrollView;
1297
-
1298
1299
  return this._needsScrollView() || !Animated.FlatList ? (
1299
1300
  <ScrollViewComponent {...props}>
1300
1301
  {this._getCustomData().map((item, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/carousel",
3
- "version": "0.0.59-beta.9",
3
+ "version": "0.0.60-alpha.1",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {