@momo-kits/template 0.81.1 → 0.81.2-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/{HeaderBanner → HeaderSliderBanner}/index.tsx +24 -16
- package/{HeaderBanner → HeaderSliderBanner}/types.ts +2 -1
- package/TrustBanner/CustomAvatar.tsx +37 -0
- package/TrustBanner/index.tsx +82 -0
- package/TrustBanner/styles.ts +46 -0
- package/TrustBanner/types.ts +15 -0
- package/index.tsx +3 -3
- package/package.json +4 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, {FC} from 'react';
|
|
2
|
-
import {Animated, TouchableOpacity} from 'react-native';
|
|
2
|
+
import {Animated, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import Carousel from '@momo-kits/carousel';
|
|
4
4
|
import {Image, Pagination, Spacing} from '@momo-kits/foundation';
|
|
5
|
-
import {
|
|
5
|
+
import {HeaderSliderBannerProps} from './types';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
|
|
8
8
|
animatedValue = new Animated.Value(0),
|
|
9
9
|
paginationBottom = 56,
|
|
10
10
|
data = [],
|
|
@@ -13,10 +13,11 @@ const HeaderBanner: FC<HeaderBannerProps> = ({
|
|
|
13
13
|
carouselProps,
|
|
14
14
|
onSnapToItem,
|
|
15
15
|
onPressItem,
|
|
16
|
+
paginationType = 'black_white',
|
|
16
17
|
}) => {
|
|
17
18
|
const scale = animatedValue.interpolate({
|
|
18
19
|
inputRange: [-300, 0, 300],
|
|
19
|
-
outputRange: [
|
|
20
|
+
outputRange: [4, 1, 1],
|
|
20
21
|
extrapolate: 'clamp',
|
|
21
22
|
});
|
|
22
23
|
const opacity = animatedValue.interpolate({
|
|
@@ -26,10 +27,15 @@ const HeaderBanner: FC<HeaderBannerProps> = ({
|
|
|
26
27
|
});
|
|
27
28
|
const translateY = animatedValue.interpolate({
|
|
28
29
|
inputRange: [-300, 0],
|
|
29
|
-
outputRange: [-
|
|
30
|
+
outputRange: [-80, -2],
|
|
30
31
|
extrapolate: 'clamp',
|
|
31
32
|
});
|
|
32
33
|
|
|
34
|
+
const paginationOpacity = animatedValue.interpolate({
|
|
35
|
+
inputRange: [-40, 0],
|
|
36
|
+
outputRange: [0, 1],
|
|
37
|
+
});
|
|
38
|
+
|
|
33
39
|
const renderItem = (info: {item: any; index: number}) => {
|
|
34
40
|
const {item, index} = info;
|
|
35
41
|
return (
|
|
@@ -47,31 +53,33 @@ const HeaderBanner: FC<HeaderBannerProps> = ({
|
|
|
47
53
|
return (
|
|
48
54
|
<Animated.View
|
|
49
55
|
style={{
|
|
50
|
-
|
|
56
|
+
height: 210,
|
|
51
57
|
opacity: opacity,
|
|
52
58
|
transform: [{scale}, {translateY}],
|
|
53
59
|
}}>
|
|
54
60
|
<Carousel
|
|
55
61
|
{...carouselProps}
|
|
56
|
-
autoplay
|
|
57
62
|
full={true}
|
|
58
63
|
data={data}
|
|
59
64
|
onSnapToItem={onSnapToItem}
|
|
60
65
|
renderItem={renderItem}
|
|
61
66
|
/>
|
|
62
|
-
<
|
|
63
|
-
{...paginationProps}
|
|
67
|
+
<Animated.View
|
|
64
68
|
style={{
|
|
65
69
|
position: 'absolute',
|
|
66
|
-
bottom: paginationBottom
|
|
70
|
+
bottom: paginationBottom - Spacing.S,
|
|
67
71
|
alignSelf: 'center',
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
opacity: paginationOpacity,
|
|
73
|
+
}}>
|
|
74
|
+
<Pagination
|
|
75
|
+
{...paginationProps}
|
|
76
|
+
activeIndex={activeIndex}
|
|
77
|
+
dataLength={data.length}
|
|
78
|
+
type={paginationType}
|
|
79
|
+
/>
|
|
80
|
+
</Animated.View>
|
|
73
81
|
</Animated.View>
|
|
74
82
|
);
|
|
75
83
|
};
|
|
76
84
|
|
|
77
|
-
export default
|
|
85
|
+
export default HeaderSliderBanner;
|
|
@@ -3,7 +3,7 @@ import {CarouselProps} from '@momo-kits/carousel';
|
|
|
3
3
|
import {Animated} from 'react-native';
|
|
4
4
|
import AnimatedValue = Animated.AnimatedValue;
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type HeaderSliderBannerProps = {
|
|
7
7
|
animatedValue: AnimatedValue;
|
|
8
8
|
data: string[];
|
|
9
9
|
onSnapToItem: (index: number) => void;
|
|
@@ -12,4 +12,5 @@ export type HeaderBannerProps = {
|
|
|
12
12
|
carouselProps?: CarouselProps;
|
|
13
13
|
paginationBottom?: 8 | 24 | 56;
|
|
14
14
|
onPressItem?: () => void;
|
|
15
|
+
paginationType: 'black_white' | 'number';
|
|
15
16
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import styles from './styles';
|
|
4
|
+
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
5
|
+
import {CustomAvatarProps} from './types';
|
|
6
|
+
|
|
7
|
+
const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
|
|
8
|
+
const {theme} = useContext(ApplicationContext);
|
|
9
|
+
|
|
10
|
+
const renderContent = () => {
|
|
11
|
+
if (text) {
|
|
12
|
+
return (
|
|
13
|
+
<Text color={theme.colors.primary} typography={'description_xs'}>
|
|
14
|
+
{text}
|
|
15
|
+
</Text>
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return <Image style={styles.avatarImage} source={{uri: image}} />;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View
|
|
24
|
+
style={[
|
|
25
|
+
styles.customAvatar,
|
|
26
|
+
{
|
|
27
|
+
backgroundColor: Colors.black_01,
|
|
28
|
+
borderColor: theme.colors.border.default,
|
|
29
|
+
},
|
|
30
|
+
style,
|
|
31
|
+
]}>
|
|
32
|
+
{renderContent()}
|
|
33
|
+
</View>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default CustomAvatar;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import {View} from 'react-native';
|
|
3
|
+
import {TrustBannerProps} from './types';
|
|
4
|
+
import styles from './styles';
|
|
5
|
+
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
6
|
+
import CustomAvatar from './CustomAvatar';
|
|
7
|
+
|
|
8
|
+
const defaultIcons = [
|
|
9
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_viettinbank.png',
|
|
10
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_agribank.png',
|
|
11
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_vietcombank.png',
|
|
12
|
+
'https://static.momocdn.net/app/img/kits/trustBanner/ic_bidv.png',
|
|
13
|
+
];
|
|
14
|
+
const TrustBanner: FC<TrustBannerProps> = ({
|
|
15
|
+
message = 'Bảo mật thông tin & An toàn tài sản của bạn là ưu tiên hàng đầu của MoMo.',
|
|
16
|
+
pciImage = 'https://static.momocdn.net/app/img/kits/trustBanner/pci.png',
|
|
17
|
+
sslImage = 'https://static.momocdn.net/app/img/kits/trustBanner/ssl.png',
|
|
18
|
+
icons = defaultIcons,
|
|
19
|
+
style,
|
|
20
|
+
}) => {
|
|
21
|
+
const {theme} = useContext(ApplicationContext);
|
|
22
|
+
|
|
23
|
+
const renderIconList = () => {
|
|
24
|
+
return (
|
|
25
|
+
<View style={styles.iconList}>
|
|
26
|
+
{icons.map(icon => {
|
|
27
|
+
return <CustomAvatar image={icon} />;
|
|
28
|
+
})}
|
|
29
|
+
<CustomAvatar
|
|
30
|
+
style={[
|
|
31
|
+
styles.customAvatar,
|
|
32
|
+
{
|
|
33
|
+
borderColor: theme.colors.border.default,
|
|
34
|
+
backgroundColor: Colors.pink_09,
|
|
35
|
+
},
|
|
36
|
+
]}
|
|
37
|
+
text="+36"
|
|
38
|
+
/>
|
|
39
|
+
</View>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const renderFooter = () => {
|
|
44
|
+
return (
|
|
45
|
+
<View style={styles.footer}>
|
|
46
|
+
<View style={styles.imageList}>
|
|
47
|
+
<Image
|
|
48
|
+
resizeMode={'contain'}
|
|
49
|
+
style={[styles.image, styles.pciImage]}
|
|
50
|
+
source={{uri: pciImage}}
|
|
51
|
+
/>
|
|
52
|
+
<Image
|
|
53
|
+
resizeMode={'contain'}
|
|
54
|
+
style={styles.image}
|
|
55
|
+
source={{uri: sslImage}}
|
|
56
|
+
/>
|
|
57
|
+
</View>
|
|
58
|
+
{renderIconList()}
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return (
|
|
64
|
+
<View style={[style, styles.container]}>
|
|
65
|
+
<Image
|
|
66
|
+
style={styles.momoImage}
|
|
67
|
+
resizeMode={'contain'}
|
|
68
|
+
source={{
|
|
69
|
+
uri: 'https://static.momocdn.net/app/img/kits/trustBanner/ic_momo_secu.png',
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
72
|
+
<View style={styles.flex}>
|
|
73
|
+
<Text style={styles.message} typography={'description_s'}>
|
|
74
|
+
{message}
|
|
75
|
+
</Text>
|
|
76
|
+
{renderFooter()}
|
|
77
|
+
</View>
|
|
78
|
+
</View>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default TrustBanner;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {StyleSheet} from 'react-native';
|
|
2
|
+
import {Colors, Radius, scaleSize, Spacing} from '@momo-kits/foundation';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
container: {
|
|
6
|
+
flexDirection: 'row',
|
|
7
|
+
padding: Spacing.M,
|
|
8
|
+
borderRadius: Radius.S,
|
|
9
|
+
backgroundColor: Colors.blue_10,
|
|
10
|
+
width: '100%',
|
|
11
|
+
},
|
|
12
|
+
flex: {flex: 1},
|
|
13
|
+
momoImage: {
|
|
14
|
+
width: scaleSize(64),
|
|
15
|
+
height: scaleSize(64),
|
|
16
|
+
marginRight: Spacing.S,
|
|
17
|
+
},
|
|
18
|
+
image: {
|
|
19
|
+
width: scaleSize(52),
|
|
20
|
+
height: scaleSize(20),
|
|
21
|
+
},
|
|
22
|
+
imageList: {
|
|
23
|
+
flexDirection: 'row',
|
|
24
|
+
},
|
|
25
|
+
pciImage: {
|
|
26
|
+
marginRight: Spacing.XS,
|
|
27
|
+
},
|
|
28
|
+
message: {marginBottom: Spacing.S},
|
|
29
|
+
footer: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
},
|
|
33
|
+
customAvatar: {
|
|
34
|
+
width: scaleSize(24),
|
|
35
|
+
height: scaleSize(24),
|
|
36
|
+
borderWidth: 1,
|
|
37
|
+
borderRadius: Radius.L,
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
marginLeft: scaleSize(-6),
|
|
41
|
+
},
|
|
42
|
+
iconList: {
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
},
|
|
45
|
+
avatarImage: {width: '100%', height: '100%'},
|
|
46
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type TrustBannerProps = {
|
|
4
|
+
message?: string;
|
|
5
|
+
icons?: string[];
|
|
6
|
+
pciImage?: string;
|
|
7
|
+
sslImage?: string;
|
|
8
|
+
style?: ViewStyle | ViewStyle[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type CustomAvatarProps = {
|
|
12
|
+
image?: string;
|
|
13
|
+
text?: string;
|
|
14
|
+
style?: ViewStyle[] | ViewStyle;
|
|
15
|
+
};
|
package/index.tsx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export {
|
|
1
|
+
import HeaderSliderBanner from './HeaderSliderBanner';
|
|
2
|
+
import TrustBanner from './TrustBanner';
|
|
3
|
+
export {HeaderSliderBanner, TrustBanner};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/template",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.2-beta.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"dependencies": {},
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"react": "16.9.0",
|
|
12
12
|
"react-native": ">=0.55"
|
|
13
13
|
},
|
|
14
|
-
"devDependencies": {
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@momo-platform/versions": "4.1.11"
|
|
16
|
+
},
|
|
15
17
|
"license": "MoMo"
|
|
16
18
|
}
|