@momo-kits/carousel 0.150.3-beta.20 → 0.151.1-beta.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/animation.ts +17 -148
- package/index.tsx +700 -1330
- package/package.json +20 -20
- package/types.ts +18 -64
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
2
|
+
"name": "@momo-kits/carousel",
|
|
3
|
+
"version": "0.151.1-beta.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@momo-kits/foundation": "latest",
|
|
8
|
+
"react": "*",
|
|
9
|
+
"react-native": "*"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@momo-platform/versions": "4.1.11"
|
|
13
|
+
},
|
|
14
|
+
"license": "MoMo",
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org/"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"moment": "^2.24.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/types.ts
CHANGED
|
@@ -1,107 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Animated,
|
|
3
|
-
LayoutChangeEvent,
|
|
4
3
|
NativeScrollEvent,
|
|
5
4
|
NativeSyntheticEvent,
|
|
6
5
|
StyleProp,
|
|
7
6
|
ViewStyle,
|
|
8
7
|
} from 'react-native';
|
|
9
|
-
import React from 'react';
|
|
10
8
|
|
|
11
9
|
export type CarouselProps = {
|
|
12
|
-
data: any[];
|
|
13
|
-
renderItem: (
|
|
14
|
-
info: {
|
|
15
|
-
item: any;
|
|
16
|
-
index: number;
|
|
17
|
-
dataIndex: number;
|
|
18
|
-
realIndex: number;
|
|
19
|
-
activeIndex: number;
|
|
20
|
-
},
|
|
21
|
-
parallaxProps?: any,
|
|
22
|
-
) => React.ReactNode;
|
|
23
|
-
itemWidth: number;
|
|
24
|
-
itemHeight: number;
|
|
25
|
-
sliderWidth: number;
|
|
26
|
-
sliderHeight: number;
|
|
27
|
-
activeSlideAlignment?: 'center' | 'end' | 'start';
|
|
28
10
|
activeSlideOffset?: number;
|
|
29
11
|
apparitionDelay?: number;
|
|
30
12
|
autoplay?: boolean;
|
|
31
13
|
autoplayDelay?: number;
|
|
32
14
|
autoplayInterval?: number;
|
|
33
|
-
callbackOffsetMargin?: number;
|
|
34
|
-
containerCustomStyle?: StyleProp<ViewStyle>;
|
|
35
|
-
contentContainerCustomStyle?: StyleProp<ViewStyle>;
|
|
36
15
|
enableSnap?: boolean;
|
|
37
16
|
firstItem?: number;
|
|
38
|
-
hasParallaxImages?: boolean;
|
|
39
17
|
inactiveSlideOpacity?: number;
|
|
40
18
|
inactiveSlideScale?: number;
|
|
41
|
-
inactiveSlideShift?: number;
|
|
42
|
-
layout?: 'default' | 'stack' | 'tinder';
|
|
43
|
-
layoutCardOffset?: number;
|
|
44
19
|
loop?: boolean;
|
|
45
20
|
loopClonesPerSide?: number;
|
|
46
21
|
scrollEnabled?: boolean;
|
|
47
|
-
scrollInterpolator?: (
|
|
48
|
-
index: number,
|
|
49
|
-
props: CarouselProps,
|
|
50
|
-
) => { inputRange: number[]; outputRange: number[] };
|
|
51
|
-
slideInterpolatedStyle?: (
|
|
52
|
-
index: number,
|
|
53
|
-
animatedValue: Animated.AnimatedInterpolation<number>,
|
|
54
|
-
props: CarouselProps,
|
|
55
|
-
) => any;
|
|
56
22
|
slideStyle?: StyleProp<ViewStyle>;
|
|
57
|
-
shouldOptimizeUpdates?: boolean;
|
|
58
|
-
swipeThreshold?: number;
|
|
59
|
-
useScrollView?: boolean | (() => any);
|
|
60
|
-
vertical?: boolean;
|
|
61
|
-
showsPagination?: boolean;
|
|
62
|
-
isCustomScrollWidth?: boolean;
|
|
63
23
|
disableIntervalMomentum?: boolean;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
data: any,
|
|
69
|
-
index: number,
|
|
70
|
-
) => { length: number; offset: number; index: number };
|
|
71
|
-
CellRendererComponent?: React.ComponentType<any>;
|
|
72
|
-
onBeforeSnapToItem?: () => void;
|
|
73
|
-
onSnapToItem?: (index: number) => void;
|
|
24
|
+
itemWidth?: number;
|
|
25
|
+
data: any[];
|
|
26
|
+
renderItem: (info: { item: any; index: number }) => React.ReactNode;
|
|
27
|
+
onScroll?: any;
|
|
74
28
|
onScrollIndexChanged?: (index: number) => void;
|
|
75
|
-
|
|
76
|
-
onLayout?: (event: LayoutChangeEvent) => void;
|
|
29
|
+
onSnapToItem?: (index: number) => void;
|
|
77
30
|
onTouchStart?: (event: any) => void;
|
|
78
31
|
onTouchEnd?: (event: any) => void;
|
|
79
32
|
onMomentumScrollEnd?: (
|
|
80
|
-
event: NativeSyntheticEvent<NativeScrollEvent
|
|
33
|
+
event: NativeSyntheticEvent<NativeScrollEvent>
|
|
81
34
|
) => void;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
35
|
+
onLayout?: (event: any) => void;
|
|
36
|
+
keyExtractor?: (item: any, index: number) => string;
|
|
37
|
+
getItemLayout?: (
|
|
38
|
+
data: any,
|
|
39
|
+
index: number
|
|
40
|
+
) => { length: number; offset: number; index: number };
|
|
41
|
+
style?: ViewStyle;
|
|
42
|
+
visibleItem?: number;
|
|
87
43
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
44
|
+
full?: boolean;
|
|
45
|
+
snapToInterval?: number | Animated.Value | Animated.AnimatedInterpolation<number | string> | undefined
|
|
88
46
|
};
|
|
89
47
|
|
|
90
48
|
export type CarouselRef = {
|
|
91
49
|
snapToItem: (
|
|
92
50
|
index: number,
|
|
93
51
|
animated?: boolean,
|
|
94
|
-
fireCallback?: boolean
|
|
52
|
+
fireCallback?: boolean
|
|
95
53
|
) => void;
|
|
96
54
|
snapToNext: (animated?: boolean, fireCallback?: boolean) => void;
|
|
97
55
|
snapToPrev: (animated?: boolean, fireCallback?: boolean) => void;
|
|
98
56
|
startAutoplay: () => void;
|
|
99
|
-
|
|
57
|
+
pauseAutoplay: () => void;
|
|
100
58
|
stopAutoplay: () => void;
|
|
101
|
-
triggerRenderingHack: (offset?: number) => void;
|
|
102
|
-
readonly realIndex: number;
|
|
103
|
-
readonly currentIndex: number;
|
|
104
|
-
readonly currentScrollPosition: number;
|
|
105
59
|
};
|
|
106
60
|
|
|
107
61
|
export type CarouselState = {
|