@momo-kits/carousel 0.0.62-beta → 0.0.66-beta

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/Carousel.js CHANGED
@@ -554,7 +554,7 @@ export default class Carousel extends PureComponent {
554
554
  interpolator = tinderScrollInterpolator(_index, props);
555
555
  }
556
556
 
557
- if (!interpolator || !interpolator.inputRange || !interpolator.outputRange) {
557
+ if (!interpolator || !interpolator?.inputRange || !interpolator?.outputRange) {
558
558
  interpolator = defaultScrollInterpolator(_index, props);
559
559
  }
560
560
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/carousel",
3
- "version": "0.0.62-beta",
3
+ "version": "0.0.66-beta",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {
package/publish.sh CHANGED
@@ -26,4 +26,4 @@ cd ..
26
26
  rm -rf dist
27
27
 
28
28
 
29
- #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/carousel new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/carousel"}'
29
+ curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/carousel new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/carousel"}'
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable no-param-reassign */
2
- import { Platform } from 'react-native';
2
+ import { Platform, Dimensions } from 'react-native';
3
3
 
4
4
  const IS_ANDROID = Platform.OS === 'android';
5
+ const { width: viewportWidth = 0, height: viewportHeight = 0 } = Dimensions.get('window') || {};
5
6
 
6
7
  // Get scroll interpolator's input range from an array of slide indexes
7
8
  // Indexes are relative to the current active slide (index 0)
@@ -14,9 +15,10 @@ const IS_ANDROID = Platform.OS === 'android';
14
15
  // (index + 1) * sizeRef // active - 1
15
16
  // ]
16
17
  export function getInputRangeFromIndexes(range, index, carouselProps) {
17
- const sizeRef = carouselProps.vertical ? carouselProps.itemHeight : carouselProps.itemWidth;
18
+ const sizeRef = carouselProps.vertical ? carouselProps.itemHeight <= 0 ? (viewportHeight || 680) : carouselProps.itemHeight:
19
+ carouselProps.itemWidth <= 0 ? (viewportWidth || 375) : carouselProps.itemWidth;
18
20
  const inputRange = [];
19
-
21
+
20
22
  for (let i = 0; i < range.length; i += 1) {
21
23
  inputRange.push((index - range[i]) * sizeRef);
22
24
  }