@momo-kits/template 0.81.15 → 0.81.16-cns.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/TrustBanner/CustomAvatar.tsx +5 -12
- package/TrustBanner/index.tsx +6 -7
- package/TrustBanner/styles.ts +30 -9
- package/TrustBanner/types.ts +2 -0
- package/index.tsx +1 -2
- package/package.json +1 -6
- package/HeaderSliderBanner/index.tsx +0 -85
- package/HeaderSliderBanner/types.ts +0 -16
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
import React, {FC
|
|
2
|
-
import {View} from 'react-native';
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
|
+
import {Image, Text, View} from 'react-native';
|
|
3
3
|
import styles from './styles';
|
|
4
|
-
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
5
4
|
import {CustomAvatarProps} from './types';
|
|
6
5
|
|
|
7
6
|
const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
|
|
8
|
-
const {theme} = useContext(ApplicationContext);
|
|
9
|
-
|
|
10
7
|
const renderContent = () => {
|
|
11
8
|
if (text) {
|
|
12
|
-
return
|
|
13
|
-
<Text color={theme.colors.primary} typography={'description_xs'}>
|
|
14
|
-
{text}
|
|
15
|
-
</Text>
|
|
16
|
-
);
|
|
9
|
+
return <Text style={styles.description_xs}>{text}</Text>;
|
|
17
10
|
}
|
|
18
11
|
|
|
19
12
|
return <Image style={styles.avatarImage} source={{uri: image}} />;
|
|
@@ -24,8 +17,8 @@ const CustomAvatar: FC<CustomAvatarProps> = ({image, text, style}) => {
|
|
|
24
17
|
style={[
|
|
25
18
|
styles.customAvatar,
|
|
26
19
|
{
|
|
27
|
-
backgroundColor:
|
|
28
|
-
borderColor:
|
|
20
|
+
backgroundColor: '#fff',
|
|
21
|
+
borderColor: '#E8E8E8',
|
|
29
22
|
},
|
|
30
23
|
style,
|
|
31
24
|
]}>
|
package/TrustBanner/index.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React, {FC,
|
|
2
|
-
import {TouchableOpacity, View} from 'react-native';
|
|
1
|
+
import React, {FC, useEffect, useState} from 'react';
|
|
2
|
+
import {Image, Text, TouchableOpacity, View} from 'react-native';
|
|
3
3
|
import {TrustBannerCallbackParams, TrustBannerProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
|
-
import {ApplicationContext, Colors, Image, Text} from '@momo-kits/foundation';
|
|
6
5
|
import CustomAvatar from './CustomAvatar';
|
|
7
6
|
|
|
8
7
|
const dataJsonUrl =
|
|
@@ -35,8 +34,8 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
35
34
|
serviceName = '',
|
|
36
35
|
onPress,
|
|
37
36
|
trackEvent,
|
|
37
|
+
language = 'vi',
|
|
38
38
|
}) => {
|
|
39
|
-
const {theme, language} = useContext(ApplicationContext);
|
|
40
39
|
const [data, setData] = useState(defaultData);
|
|
41
40
|
const {
|
|
42
41
|
icons,
|
|
@@ -86,8 +85,8 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
86
85
|
style={[
|
|
87
86
|
styles.customAvatar,
|
|
88
87
|
{
|
|
89
|
-
borderColor:
|
|
90
|
-
backgroundColor:
|
|
88
|
+
borderColor: '#E8E8E8',
|
|
89
|
+
backgroundColor: '#FDEAF4',
|
|
91
90
|
},
|
|
92
91
|
]}
|
|
93
92
|
text="+36"
|
|
@@ -134,7 +133,7 @@ const TrustBanner: FC<TrustBannerProps> = ({
|
|
|
134
133
|
}}
|
|
135
134
|
/>
|
|
136
135
|
<View style={styles.flex}>
|
|
137
|
-
<Text style={styles.message
|
|
136
|
+
<Text style={[styles.message, styles.description_s]}>
|
|
138
137
|
{content?.[language || 'vi'] || defaultData.content.vi}
|
|
139
138
|
</Text>
|
|
140
139
|
{renderFooter()}
|
package/TrustBanner/styles.ts
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
import {StyleSheet} from 'react-native';
|
|
2
|
-
|
|
1
|
+
import {Dimensions, StyleSheet} from 'react-native';
|
|
2
|
+
|
|
3
|
+
const deviceWidth = Dimensions.get('window').width;
|
|
4
|
+
const DEFAULT_SCREEN_SIZE = 375;
|
|
5
|
+
const scaleSize = (size: number) => {
|
|
6
|
+
const scaleRate = deviceWidth / DEFAULT_SCREEN_SIZE;
|
|
7
|
+
|
|
8
|
+
if (scaleRate > 1) {
|
|
9
|
+
return Math.min(Math.round(size * scaleRate), size + 3);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return size;
|
|
13
|
+
};
|
|
3
14
|
|
|
4
15
|
export default StyleSheet.create({
|
|
5
16
|
container: {
|
|
6
17
|
flexDirection: 'row',
|
|
7
|
-
padding:
|
|
8
|
-
borderRadius:
|
|
9
|
-
backgroundColor:
|
|
18
|
+
padding: 12,
|
|
19
|
+
borderRadius: 8,
|
|
20
|
+
backgroundColor: '#F2F8FF',
|
|
10
21
|
width: '100%',
|
|
11
22
|
},
|
|
12
23
|
flex: {flex: 1},
|
|
13
24
|
momoImage: {
|
|
14
25
|
width: scaleSize(64),
|
|
15
26
|
height: scaleSize(64),
|
|
16
|
-
marginRight:
|
|
27
|
+
marginRight: 8,
|
|
17
28
|
},
|
|
18
29
|
image: {
|
|
19
30
|
width: scaleSize(52),
|
|
@@ -23,9 +34,9 @@ export default StyleSheet.create({
|
|
|
23
34
|
flexDirection: 'row',
|
|
24
35
|
},
|
|
25
36
|
pciImage: {
|
|
26
|
-
marginRight:
|
|
37
|
+
marginRight: 4,
|
|
27
38
|
},
|
|
28
|
-
message: {marginBottom:
|
|
39
|
+
message: {marginBottom: 8},
|
|
29
40
|
footer: {
|
|
30
41
|
flexDirection: 'row',
|
|
31
42
|
justifyContent: 'space-between',
|
|
@@ -34,7 +45,7 @@ export default StyleSheet.create({
|
|
|
34
45
|
width: scaleSize(24),
|
|
35
46
|
height: scaleSize(24),
|
|
36
47
|
borderWidth: 1,
|
|
37
|
-
borderRadius:
|
|
48
|
+
borderRadius: 16,
|
|
38
49
|
alignItems: 'center',
|
|
39
50
|
justifyContent: 'center',
|
|
40
51
|
marginLeft: scaleSize(-6),
|
|
@@ -43,4 +54,14 @@ export default StyleSheet.create({
|
|
|
43
54
|
flexDirection: 'row',
|
|
44
55
|
},
|
|
45
56
|
avatarImage: {width: '100%', height: '100%'},
|
|
57
|
+
description_s: {
|
|
58
|
+
fontSize: scaleSize(12),
|
|
59
|
+
lineHeight: scaleSize(16),
|
|
60
|
+
color: '#484848',
|
|
61
|
+
},
|
|
62
|
+
description_xs: {
|
|
63
|
+
fontSize: scaleSize(10),
|
|
64
|
+
lineHeight: scaleSize(14),
|
|
65
|
+
color: '#EB2F96',
|
|
66
|
+
},
|
|
46
67
|
});
|
package/TrustBanner/types.ts
CHANGED
package/index.tsx
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/template",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.16-cns.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.tsx",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@momo-kits/foundation": "latest",
|
|
9
|
-
"@momo-kits/carousel": "0.81.6-beta.12",
|
|
10
8
|
"prop-types": "^15.7.2",
|
|
11
9
|
"react": "16.9.0",
|
|
12
10
|
"react-native": ">=0.55"
|
|
13
11
|
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@momo-platform/versions": "4.1.11"
|
|
16
|
-
},
|
|
17
12
|
"license": "MoMo"
|
|
18
13
|
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
2
|
-
import {Animated, TouchableOpacity, View} from 'react-native';
|
|
3
|
-
import Carousel from '@momo-kits/carousel';
|
|
4
|
-
import {Image, Pagination, Spacing} from '@momo-kits/foundation';
|
|
5
|
-
import {HeaderSliderBannerProps} from './types';
|
|
6
|
-
|
|
7
|
-
const HeaderSliderBanner: FC<HeaderSliderBannerProps> = ({
|
|
8
|
-
animatedValue = new Animated.Value(0),
|
|
9
|
-
paginationBottom = 56,
|
|
10
|
-
data = [],
|
|
11
|
-
activeIndex = 0,
|
|
12
|
-
paginationProps,
|
|
13
|
-
carouselProps,
|
|
14
|
-
onSnapToItem,
|
|
15
|
-
onPressItem,
|
|
16
|
-
paginationType = 'black_white',
|
|
17
|
-
}) => {
|
|
18
|
-
const scale = animatedValue.interpolate({
|
|
19
|
-
inputRange: [-300, 0, 300],
|
|
20
|
-
outputRange: [4, 1, 1],
|
|
21
|
-
extrapolate: 'clamp',
|
|
22
|
-
});
|
|
23
|
-
const opacity = animatedValue.interpolate({
|
|
24
|
-
inputRange: [0, 150, 300],
|
|
25
|
-
outputRange: [1, 0.5, 0],
|
|
26
|
-
extrapolate: 'clamp',
|
|
27
|
-
});
|
|
28
|
-
const translateY = animatedValue.interpolate({
|
|
29
|
-
inputRange: [-300, 0],
|
|
30
|
-
outputRange: [-80, -2],
|
|
31
|
-
extrapolate: 'clamp',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const paginationOpacity = animatedValue.interpolate({
|
|
35
|
-
inputRange: [-40, 0],
|
|
36
|
-
outputRange: [0, 1],
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const renderItem = (info: {item: any; index: number}) => {
|
|
40
|
-
const {item, index} = info;
|
|
41
|
-
return (
|
|
42
|
-
<TouchableOpacity disabled={!onPressItem} onPress={onPressItem}>
|
|
43
|
-
<Image
|
|
44
|
-
key={`Header banner ${item}_${index}`}
|
|
45
|
-
source={{
|
|
46
|
-
uri: item,
|
|
47
|
-
}}
|
|
48
|
-
/>
|
|
49
|
-
</TouchableOpacity>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Animated.View
|
|
55
|
-
style={{
|
|
56
|
-
height: 210,
|
|
57
|
-
opacity: opacity,
|
|
58
|
-
transform: [{scale}, {translateY}],
|
|
59
|
-
}}>
|
|
60
|
-
<Carousel
|
|
61
|
-
{...carouselProps}
|
|
62
|
-
full={true}
|
|
63
|
-
data={data}
|
|
64
|
-
onSnapToItem={onSnapToItem}
|
|
65
|
-
renderItem={renderItem}
|
|
66
|
-
/>
|
|
67
|
-
<Animated.View
|
|
68
|
-
style={{
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
bottom: paginationBottom - Spacing.S,
|
|
71
|
-
alignSelf: 'center',
|
|
72
|
-
opacity: paginationOpacity,
|
|
73
|
-
}}>
|
|
74
|
-
<Pagination
|
|
75
|
-
{...paginationProps}
|
|
76
|
-
activeIndex={activeIndex}
|
|
77
|
-
dataLength={data.length}
|
|
78
|
-
type={paginationType}
|
|
79
|
-
/>
|
|
80
|
-
</Animated.View>
|
|
81
|
-
</Animated.View>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default HeaderSliderBanner;
|
|
@@ -1,16 +0,0 @@
|
|
|
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 HeaderSliderBannerProps = {
|
|
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
|
-
onPressItem?: () => void;
|
|
15
|
-
paginationType: 'black_white' | 'number';
|
|
16
|
-
};
|