@momo-kits/carousel 0.92.7 → 0.92.8-beta.0
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/index.tsx +6 -5
- package/package.json +2 -2
- package/publish.sh +22 -23
- package/types.ts +10 -5
package/index.tsx
CHANGED
|
@@ -66,6 +66,7 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
|
|
|
66
66
|
_autoplayInterval?: NodeJS.Timeout;
|
|
67
67
|
_carouselRef: any;
|
|
68
68
|
_onLayoutInitDone?: boolean;
|
|
69
|
+
|
|
69
70
|
constructor(props: CarouselProps) {
|
|
70
71
|
super(props);
|
|
71
72
|
|
|
@@ -438,7 +439,7 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
|
|
|
438
439
|
} else {
|
|
439
440
|
let interpolator = defaultScrollInterpolator(
|
|
440
441
|
_index,
|
|
441
|
-
this.state.itemWidth
|
|
442
|
+
this.state.itemWidth
|
|
442
443
|
);
|
|
443
444
|
|
|
444
445
|
animatedValue = this._scrollPos.interpolate({
|
|
@@ -574,8 +575,8 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
|
|
|
574
575
|
? screenWidth - Spacing.M * 2
|
|
575
576
|
: Math.ceil(
|
|
576
577
|
scaleSize(
|
|
577
|
-
(containerWidth * 0.9 - visibleItem * Spacing.S) / visibleItem
|
|
578
|
-
)
|
|
578
|
+
(containerWidth * 0.9 - visibleItem * Spacing.S) / visibleItem
|
|
579
|
+
)
|
|
579
580
|
);
|
|
580
581
|
if (this.props.itemWidth) {
|
|
581
582
|
itemWidth = this.props.itemWidth;
|
|
@@ -598,7 +599,7 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
|
|
|
598
599
|
index: number,
|
|
599
600
|
animated = true,
|
|
600
601
|
fireCallback = true,
|
|
601
|
-
forceScrollTo = false
|
|
602
|
+
forceScrollTo = false
|
|
602
603
|
) {
|
|
603
604
|
const {onSnapToItem} = this.props;
|
|
604
605
|
const itemsLength = this._getCustomDataLength();
|
|
@@ -762,7 +763,7 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
|
|
|
762
763
|
enableSnap,
|
|
763
764
|
contentContainerStyle,
|
|
764
765
|
} = this.props;
|
|
765
|
-
const {hideCarousel
|
|
766
|
+
const {hideCarousel} = this.state;
|
|
766
767
|
|
|
767
768
|
const initialNumPerSide = this._enableLoop() ? loopClonesPerSide : 2;
|
|
768
769
|
const initialNumToRender =
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Prepare dist files
|
|
2
4
|
rm -rf dist
|
|
3
5
|
mkdir dist
|
|
4
|
-
|
|
5
|
-
cp . ./dist
|
|
6
|
-
|
|
7
|
-
# GET VERSION from mck_package.json
|
|
8
|
-
VERSIONSTRING=( v$(jq .version package.json) )
|
|
9
|
-
VERSION=(${VERSIONSTRING//[\"]/})
|
|
10
|
-
echo VERSION: $VERSION
|
|
11
|
-
|
|
12
|
-
rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
|
|
13
|
-
|
|
14
|
-
# #babel component to dist
|
|
15
|
-
#babel ./dist -d dist --copy-files
|
|
16
|
-
|
|
17
|
-
#copy option
|
|
18
|
-
#cp -r ./src/ dist
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
#npm login
|
|
22
|
-
#publish dist to npm
|
|
6
|
+
rsync -r --exclude=/dist ./* dist
|
|
23
7
|
cd dist
|
|
24
|
-
|
|
8
|
+
|
|
9
|
+
if [ "$1" == "stable" ]; then
|
|
10
|
+
npm version $(npm view @momo-kits/carousel@stable version)
|
|
11
|
+
npm version patch
|
|
12
|
+
npm publish --tag stable --access=public
|
|
13
|
+
elif [ "$1" == "latest" ]; then
|
|
14
|
+
npm version $(npm view @momo-kits/carousel@latest version)
|
|
15
|
+
npm version prerelease --preid=rc
|
|
16
|
+
npm publish --tag latest --access=public
|
|
17
|
+
else
|
|
18
|
+
npm version $(npm view @momo-kits/carousel@beta version)
|
|
19
|
+
npm version prerelease --preid=beta
|
|
20
|
+
npm publish --tag beta --access=public
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
PACKAGE_NAME=$(npm pkg get name)
|
|
24
|
+
NEW_PACKAGE_VERSION=$(npm pkg get version)
|
|
25
|
+
|
|
26
|
+
# Clean up
|
|
25
27
|
cd ..
|
|
26
28
|
rm -rf dist
|
|
27
|
-
|
|
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/calendar new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/calendar"}'
|
package/types.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
NativeScrollEvent,
|
|
3
|
+
NativeSyntheticEvent,
|
|
4
|
+
StyleProp,
|
|
5
|
+
ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
2
7
|
|
|
3
8
|
export type CarouselProps = {
|
|
4
9
|
activeSlideOffset?: number;
|
|
@@ -24,17 +29,17 @@ export type CarouselProps = {
|
|
|
24
29
|
onTouchStart?: (event: any) => void;
|
|
25
30
|
onTouchEnd?: (event: any) => void;
|
|
26
31
|
onMomentumScrollEnd?: (
|
|
27
|
-
event: NativeSyntheticEvent<NativeScrollEvent
|
|
32
|
+
event: NativeSyntheticEvent<NativeScrollEvent>
|
|
28
33
|
) => void;
|
|
29
34
|
onLayout?: (event: any) => void;
|
|
30
35
|
keyExtractor?: (item: any, index: number) => string;
|
|
31
36
|
getItemLayout?: (
|
|
32
37
|
data: any,
|
|
33
|
-
index: number
|
|
38
|
+
index: number
|
|
34
39
|
) => {length: number; offset: number; index: number};
|
|
35
40
|
style?: ViewStyle;
|
|
36
41
|
visibleItem?: number;
|
|
37
|
-
contentContainerStyle?: StyleProp<ViewStyle
|
|
42
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
38
43
|
full?: boolean;
|
|
39
44
|
};
|
|
40
45
|
|
|
@@ -42,7 +47,7 @@ export type CarouselRef = {
|
|
|
42
47
|
snapToItem: (
|
|
43
48
|
index: number,
|
|
44
49
|
animated?: boolean,
|
|
45
|
-
fireCallback?: boolean
|
|
50
|
+
fireCallback?: boolean
|
|
46
51
|
) => void;
|
|
47
52
|
snapToNext: (animated?: boolean, fireCallback?: boolean) => void;
|
|
48
53
|
snapToPrev: (animated?: boolean, fireCallback?: boolean) => void;
|