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