@momo-kits/carousel 0.0.61-beta.1 → 0.0.61-rc.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.
- package/CarouselV2.js +12 -11
- 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 =
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
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) => {
|