@momo-kits/template 0.80.8-beta.15
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/HeaderBanner/index.tsx +74 -0
- package/HeaderBanner/types.ts +14 -0
- package/index.tsx +3 -0
- package/package.json +16 -0
- package/publish.sh +28 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
|
+
import {Animated} from 'react-native';
|
|
3
|
+
import Carousel from '@momo-kits/carousel';
|
|
4
|
+
import {Image, Pagination, Spacing} from '@momo-kits/foundation';
|
|
5
|
+
import {HeaderBannerProps} from './types';
|
|
6
|
+
|
|
7
|
+
const HeaderBanner: FC<HeaderBannerProps> = ({
|
|
8
|
+
animatedValue = new Animated.Value(0),
|
|
9
|
+
paginationBottom = 56,
|
|
10
|
+
data = [],
|
|
11
|
+
activeIndex = 0,
|
|
12
|
+
paginationProps,
|
|
13
|
+
carouselProps,
|
|
14
|
+
onSnapToItem,
|
|
15
|
+
}) => {
|
|
16
|
+
const scale = animatedValue.interpolate({
|
|
17
|
+
inputRange: [-300, 0, 300],
|
|
18
|
+
outputRange: [2, 1, 1],
|
|
19
|
+
extrapolate: 'clamp',
|
|
20
|
+
});
|
|
21
|
+
const opacity = animatedValue.interpolate({
|
|
22
|
+
inputRange: [0, 150, 300],
|
|
23
|
+
outputRange: [1, 0.5, 0],
|
|
24
|
+
extrapolate: 'clamp',
|
|
25
|
+
});
|
|
26
|
+
const translateY = animatedValue.interpolate({
|
|
27
|
+
inputRange: [-300, 0],
|
|
28
|
+
outputRange: [-160, -2],
|
|
29
|
+
extrapolate: 'clamp',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const renderItem = (info: {item: any; index: number}) => {
|
|
33
|
+
const {item, index} = info;
|
|
34
|
+
return (
|
|
35
|
+
<Image
|
|
36
|
+
key={`Header banner ${item}_${index}`}
|
|
37
|
+
source={{
|
|
38
|
+
uri: item,
|
|
39
|
+
}}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Animated.View
|
|
46
|
+
style={{
|
|
47
|
+
aspectRatio: 1.75,
|
|
48
|
+
opacity: opacity,
|
|
49
|
+
transform: [{scale}, {translateY}],
|
|
50
|
+
}}>
|
|
51
|
+
<Carousel
|
|
52
|
+
{...carouselProps}
|
|
53
|
+
autoplay
|
|
54
|
+
full={true}
|
|
55
|
+
data={data}
|
|
56
|
+
onSnapToItem={onSnapToItem}
|
|
57
|
+
renderItem={renderItem}
|
|
58
|
+
/>
|
|
59
|
+
<Pagination
|
|
60
|
+
{...paginationProps}
|
|
61
|
+
style={{
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
bottom: paginationBottom + Spacing.XL,
|
|
64
|
+
alignSelf: 'center',
|
|
65
|
+
}}
|
|
66
|
+
activeIndex={activeIndex}
|
|
67
|
+
dataLength={data.length}
|
|
68
|
+
type={'black_white'}
|
|
69
|
+
/>
|
|
70
|
+
</Animated.View>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default HeaderBanner;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {PaginationProps} from '@momo-kits/foundation';
|
|
2
|
+
import {CarouselProps} from '@momo-kits/carousel';
|
|
3
|
+
import {Animated} from 'react-native';
|
|
4
|
+
import AnimatedValue = Animated.AnimatedValue;
|
|
5
|
+
|
|
6
|
+
export type HeaderBannerProps = {
|
|
7
|
+
animatedValue: AnimatedValue;
|
|
8
|
+
data: string[];
|
|
9
|
+
onSnapToItem: (index: number) => void;
|
|
10
|
+
activeIndex: number;
|
|
11
|
+
paginationProps?: PaginationProps;
|
|
12
|
+
carouselProps?: CarouselProps;
|
|
13
|
+
paginationBottom?: 8 | 24 | 56;
|
|
14
|
+
};
|
package/index.tsx
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@momo-kits/template",
|
|
3
|
+
"version": "0.80.8-beta.15",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@momo-kits/foundation": "latest",
|
|
9
|
+
"@momo-kits/carousel": "0.80.8-beta.12",
|
|
10
|
+
"prop-types": "^15.7.2",
|
|
11
|
+
"react": "16.9.0",
|
|
12
|
+
"react-native": ">=0.55"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {},
|
|
15
|
+
"license": "MoMo"
|
|
16
|
+
}
|
package/publish.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
rm -rf dist
|
|
3
|
+
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
|
|
23
|
+
cd dist
|
|
24
|
+
npm publish --tag beta --access=public
|
|
25
|
+
cd ..
|
|
26
|
+
rm -rf dist
|
|
27
|
+
|
|
28
|
+
##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/bank new version release: '*"$VERSION"*' `https://www.npmjs.com/package/@momo-kits/avatar`"}'
|