@momo-kits/carousel 0.80.1-beta.2 → 0.80.4-beta.2

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/animation.ts CHANGED
@@ -1,5 +1,13 @@
1
- export function getInputRangeFromIndexes(range, index, carouselProps) {
2
- const sizeRef = carouselProps.itemWidth;
1
+ import {ReactNode} from 'react';
2
+ import {Animated} from 'react-native';
3
+ import {CarouselProps} from './types';
4
+
5
+ export function getInputRangeFromIndexes(
6
+ range: string | any[],
7
+ index: number,
8
+ itemWidth: number,
9
+ ) {
10
+ const sizeRef = itemWidth;
3
11
  const inputRange = [];
4
12
 
5
13
  for (let i = 0; i < range.length; i++) {
@@ -9,14 +17,18 @@ export function getInputRangeFromIndexes(range, index, carouselProps) {
9
17
  return inputRange;
10
18
  }
11
19
 
12
- export function defaultScrollInterpolator(index, carouselProps) {
20
+ export function defaultScrollInterpolator(index: number, itemWidth: number) {
13
21
  const range = [1, 0, -1];
14
- const inputRange = getInputRangeFromIndexes(range, index, carouselProps);
22
+ const inputRange = getInputRangeFromIndexes(range, index, itemWidth);
15
23
  const outputRange = [0, 1, 0];
16
24
 
17
25
  return {inputRange, outputRange};
18
26
  }
19
- export function defaultAnimatedStyles(_index, animatedValue, carouselProps) {
27
+
28
+ export function defaultAnimatedStyles(
29
+ animatedValue: Animated.Value,
30
+ carouselProps: Readonly<CarouselProps> & Readonly<{children?: ReactNode}>,
31
+ ) {
20
32
  let animatedOpacity = {};
21
33
  let animatedScale = {};
22
34
 
@@ -33,7 +45,7 @@ export function defaultAnimatedStyles(_index, animatedValue, carouselProps) {
33
45
  animatedScale = {
34
46
  transform: [
35
47
  {
36
- scale: animatedValue.interpolate({
48
+ scaleY: animatedValue.interpolate({
37
49
  inputRange: [0, 1],
38
50
  outputRange: [carouselProps.inactiveSlideScale, 1],
39
51
  }),