@momo-kits/foundation 0.77.8 → 0.78.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/Application/BottomTab.tsx +13 -3
- package/Application/Components.tsx +51 -4
- package/Application/ModalScreen.tsx +43 -15
- package/Application/Navigation.ts +4 -2
- package/Application/NavigationContainer.tsx +22 -1
- package/Application/index.ts +8 -2
- package/Application/types.ts +19 -15
- package/Application/utils.tsx +13 -0
- package/Assets/DotAnimation.json +256 -0
- package/Assets/SpinnerAnimation.json +1027 -0
- package/Button/index.tsx +25 -14
- package/CheckBox/index.tsx +29 -24
- package/CheckBox/styles.ts +1 -1
- package/CheckBox/types.ts +1 -1
- package/Consts/styles.ts +0 -26
- package/Divider/index.tsx +2 -0
- package/Input/Input.tsx +126 -106
- package/Input/InputMoney.tsx +118 -110
- package/Input/InputSearch.tsx +129 -134
- package/Input/InputTextArea.tsx +126 -118
- package/Input/common.tsx +11 -5
- package/Input/index.tsx +12 -0
- package/Layout/Card.tsx +9 -2
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/Item.tsx +15 -2
- package/Layout/Screen.tsx +76 -8
- package/Layout/Section.tsx +36 -3
- package/Layout/index.ts +1 -1
- package/Layout/types.ts +0 -37
- package/Layout/utils.ts +6 -9
- package/Loader/DotLoader.tsx +37 -0
- package/Loader/Loader.tsx +13 -0
- package/Loader/ProgressBar.tsx +44 -0
- package/Loader/Spinner.tsx +29 -0
- package/Loader/index.tsx +4 -0
- package/Loader/styles.ts +10 -0
- package/Loader/types.ts +35 -0
- package/Loader/utils.ts +25 -0
- package/Pagination/PaginationNumber.tsx +1 -2
- package/Pagination/PaginationWhiteDot.tsx +1 -3
- package/Popup/PopupNotify.tsx +11 -17
- package/Popup/PopupPromotion.tsx +19 -13
- package/Popup/types.ts +9 -1
- package/Radio/index.tsx +1 -1
- package/Skeleton/types.ts +3 -0
- package/Text/index.tsx +1 -16
- package/Text/utils.ts +1 -1
- package/code-scanner.js +51 -0
- package/index.ts +2 -0
- package/package.json +8 -4
- package/tsconfig.json +25 -0
- package/Application/NavigationButton.tsx +0 -54
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import AnimatedLottieView from 'lottie-react-native';
|
|
3
|
+
import animation from '../Assets/DotAnimation.json';
|
|
4
|
+
import {ApplicationContext} from '../Application';
|
|
5
|
+
import {hexToRGBA} from './utils';
|
|
6
|
+
import {LoaderProps} from './types';
|
|
7
|
+
|
|
8
|
+
const DotLoader: FC<LoaderProps> = ({color}) => {
|
|
9
|
+
const {theme} = useContext(ApplicationContext);
|
|
10
|
+
|
|
11
|
+
const arrayColor = [
|
|
12
|
+
color ?? theme.colors.primary,
|
|
13
|
+
theme.colors.background.surface,
|
|
14
|
+
color ?? theme.colors.primary,
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
let source: any = animation;
|
|
18
|
+
source.assets[0].layers[0].shapes[0].it.forEach((item: any) => {
|
|
19
|
+
if (item.ty === 'fl' && item.c) {
|
|
20
|
+
item.c.k.forEach((fillItem: any, index: number) => {
|
|
21
|
+
if (typeof fillItem !== 'number') {
|
|
22
|
+
fillItem.s = hexToRGBA(arrayColor[index] as string);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<AnimatedLottieView
|
|
30
|
+
source={source}
|
|
31
|
+
style={{width: 52, height: 18}}
|
|
32
|
+
autoPlay
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default DotLoader;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
|
+
import {LoaderProps} from './types';
|
|
3
|
+
import DotLoader from './DotLoader';
|
|
4
|
+
import Spinner from './Spinner';
|
|
5
|
+
|
|
6
|
+
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
7
|
+
if (type === 'spinner') {
|
|
8
|
+
return <Spinner {...props} key={props.color} />;
|
|
9
|
+
}
|
|
10
|
+
return <DotLoader {...props} key={props.color} />;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default Loader;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, {FC, useContext, useEffect, useRef} from 'react';
|
|
2
|
+
import {Animated, View} from 'react-native';
|
|
3
|
+
import styles from './styles';
|
|
4
|
+
import {ProgressBarProps} from './types';
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
|
+
import {Radius} from '../Consts';
|
|
7
|
+
|
|
8
|
+
const ProgressBar: FC<ProgressBarProps> = ({percent = 0, style}) => {
|
|
9
|
+
const {theme} = useContext(ApplicationContext);
|
|
10
|
+
const animation = useRef(new Animated.Value(0)).current;
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
Animated.timing(animation, {
|
|
14
|
+
toValue: percent,
|
|
15
|
+
duration: 200,
|
|
16
|
+
useNativeDriver: false,
|
|
17
|
+
}).start();
|
|
18
|
+
}, [percent, animation]);
|
|
19
|
+
|
|
20
|
+
const width = animation.interpolate({
|
|
21
|
+
inputRange: [0, 100],
|
|
22
|
+
outputRange: ['0%', '100%'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<View
|
|
27
|
+
style={[
|
|
28
|
+
style,
|
|
29
|
+
styles.progressContainer,
|
|
30
|
+
{backgroundColor: theme.colors.background.default},
|
|
31
|
+
]}>
|
|
32
|
+
<Animated.View
|
|
33
|
+
style={{
|
|
34
|
+
height: 4,
|
|
35
|
+
borderRadius: Radius.XXS,
|
|
36
|
+
width,
|
|
37
|
+
backgroundColor: theme.colors.primary,
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
</View>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default ProgressBar;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
|
+
import AnimatedLottieView from 'lottie-react-native';
|
|
3
|
+
import animation from '../Assets/SpinnerAnimation.json';
|
|
4
|
+
import {hexToRGBA} from './utils';
|
|
5
|
+
import {ApplicationContext} from '../Application';
|
|
6
|
+
import {LoaderProps} from './types';
|
|
7
|
+
|
|
8
|
+
const Spinner: FC<LoaderProps> = ({color}) => {
|
|
9
|
+
const {theme} = useContext(ApplicationContext);
|
|
10
|
+
|
|
11
|
+
let source: any = animation;
|
|
12
|
+
source.assets[0].layers.forEach((layer: any) => {
|
|
13
|
+
layer.shapes[0].it.forEach((item: any) => {
|
|
14
|
+
if (item.ty === 'fl' && item.c) {
|
|
15
|
+
item.c.k = hexToRGBA(color ?? theme.colors.primary);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<AnimatedLottieView
|
|
22
|
+
source={source}
|
|
23
|
+
style={{width: 24, height: 24}}
|
|
24
|
+
autoPlay
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default Spinner;
|
package/Loader/index.tsx
ADDED
package/Loader/styles.ts
ADDED
package/Loader/types.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {ViewStyle} from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type LoaderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Optional. Type of loader, can be 'dot' or 'spinner'.
|
|
6
|
+
*/
|
|
7
|
+
type?: 'dot' | 'spinner';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Optional. Color for the loader.
|
|
11
|
+
*/
|
|
12
|
+
color?: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Optional. Style or styles for the loader component.
|
|
16
|
+
*/
|
|
17
|
+
style?: ViewStyle | ViewStyle[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ProgressBarProps = {
|
|
21
|
+
/**
|
|
22
|
+
* Required. Percentage value to display on the progress bar.
|
|
23
|
+
*/
|
|
24
|
+
percent: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional. Color for the progress bar.
|
|
28
|
+
*/
|
|
29
|
+
color?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Optional. Style or styles for the progress bar component.
|
|
33
|
+
*/
|
|
34
|
+
style?: ViewStyle | ViewStyle[];
|
|
35
|
+
};
|
package/Loader/utils.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const hexToRGBA = (hex: string) => {
|
|
2
|
+
const normalizedHex = hex.startsWith('#') ? hex.slice(1) : hex;
|
|
3
|
+
|
|
4
|
+
if (!/^([0-9A-Fa-f]{3}){1,2}$/.test(normalizedHex)) {
|
|
5
|
+
throw new Error('Invalid HEX color.');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const expandedHex =
|
|
9
|
+
normalizedHex.length === 3
|
|
10
|
+
? normalizedHex
|
|
11
|
+
.split('')
|
|
12
|
+
.map(val => val + val)
|
|
13
|
+
.join('')
|
|
14
|
+
: normalizedHex;
|
|
15
|
+
|
|
16
|
+
const hexMatch = expandedHex.match(/.{2}/g);
|
|
17
|
+
|
|
18
|
+
if (!hexMatch) {
|
|
19
|
+
throw new Error('HEX parsing failed.');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return hexMatch
|
|
23
|
+
.map(val => parseInt(val, 16))
|
|
24
|
+
.map(val => Math.round((val / 255) * 1000) / 1000);
|
|
25
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React, {FC
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {ChildPaginationProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import {Text} from '../Text';
|
|
6
|
-
import {ApplicationContext} from '../Application';
|
|
7
6
|
import {Colors} from '../Consts';
|
|
8
7
|
|
|
9
8
|
const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import React, {FC
|
|
1
|
+
import React, {FC} from 'react';
|
|
2
2
|
import {View} from 'react-native';
|
|
3
3
|
import {ChildPaginationProps} from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import Dot from './Dot';
|
|
6
6
|
import {Colors, Spacing} from '../Consts';
|
|
7
|
-
import {ApplicationContext} from '../Application';
|
|
8
7
|
|
|
9
8
|
const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
10
9
|
dataLength = 2,
|
|
11
10
|
activeIndex = 0,
|
|
12
11
|
}) => {
|
|
13
|
-
const {theme} = useContext(ApplicationContext);
|
|
14
12
|
const renderDots = () => {
|
|
15
13
|
const dots = [];
|
|
16
14
|
for (let i = 0; i < dataLength; i++) {
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -10,8 +10,8 @@ import {Icon} from '../Icon';
|
|
|
10
10
|
|
|
11
11
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
12
12
|
image,
|
|
13
|
-
title,
|
|
14
|
-
description,
|
|
13
|
+
title = 'Title',
|
|
14
|
+
description = 'Description',
|
|
15
15
|
information,
|
|
16
16
|
secondary,
|
|
17
17
|
primary,
|
|
@@ -110,9 +110,10 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
110
110
|
*/
|
|
111
111
|
const buildCloseIcon = () => {
|
|
112
112
|
return (
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
<TouchableOpacity
|
|
114
|
+
style={styles.iconCloseContainer}
|
|
115
|
+
onPress={() => onAction(onIconClose)}>
|
|
116
|
+
<View
|
|
116
117
|
style={[
|
|
117
118
|
styles.iconClose,
|
|
118
119
|
{
|
|
@@ -125,8 +126,8 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
125
126
|
color={theme.colors.background.surface}
|
|
126
127
|
size={14}
|
|
127
128
|
/>
|
|
128
|
-
</
|
|
129
|
-
</
|
|
129
|
+
</View>
|
|
130
|
+
</TouchableOpacity>
|
|
130
131
|
);
|
|
131
132
|
};
|
|
132
133
|
|
|
@@ -191,8 +192,9 @@ const styles = StyleSheet.create({
|
|
|
191
192
|
},
|
|
192
193
|
iconCloseContainer: {
|
|
193
194
|
position: 'absolute',
|
|
194
|
-
top: -Spacing.
|
|
195
|
-
right: -Spacing.
|
|
195
|
+
top: -Spacing.M,
|
|
196
|
+
right: -Spacing.M,
|
|
197
|
+
padding: Spacing.XS,
|
|
196
198
|
},
|
|
197
199
|
iconClose: {
|
|
198
200
|
width: 20,
|
|
@@ -204,12 +206,4 @@ const styles = StyleSheet.create({
|
|
|
204
206
|
},
|
|
205
207
|
});
|
|
206
208
|
|
|
207
|
-
PopupNotify.defaultProps = {
|
|
208
|
-
title: 'Title',
|
|
209
|
-
primary: {
|
|
210
|
-
title: 'Primary',
|
|
211
|
-
onPress: () => {},
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
|
|
215
209
|
export default PopupNotify;
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -20,18 +20,21 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({image, onClose}) => {
|
|
|
20
20
|
navigator?.pop();
|
|
21
21
|
onClose?.();
|
|
22
22
|
}}
|
|
23
|
-
style={
|
|
24
|
-
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
style={styles.iconButton}>
|
|
24
|
+
<View
|
|
25
|
+
style={[
|
|
26
|
+
styles.iconClose,
|
|
27
|
+
{
|
|
28
|
+
backgroundColor: theme.colors.text.default,
|
|
29
|
+
borderColor: theme.colors.background.surface,
|
|
30
|
+
},
|
|
31
|
+
]}>
|
|
32
|
+
<Icon
|
|
33
|
+
source="navigation_close"
|
|
34
|
+
color={theme.colors.background.surface}
|
|
35
|
+
size={14}
|
|
36
|
+
/>
|
|
37
|
+
</View>
|
|
35
38
|
</TouchableOpacity>
|
|
36
39
|
</View>
|
|
37
40
|
);
|
|
@@ -58,7 +61,10 @@ const styles = StyleSheet.create({
|
|
|
58
61
|
width: '100%',
|
|
59
62
|
flexDirection: 'row',
|
|
60
63
|
justifyContent: 'center',
|
|
61
|
-
marginTop: Spacing.
|
|
64
|
+
marginTop: Spacing.S,
|
|
65
|
+
},
|
|
66
|
+
iconButton: {
|
|
67
|
+
padding: 8,
|
|
62
68
|
},
|
|
63
69
|
iconClose: {
|
|
64
70
|
width: 20,
|
package/Popup/types.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {TextStyle} from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
1
4
|
export type PopupNotifyProps = {
|
|
2
5
|
/**
|
|
3
6
|
* `image`: Optional. Represents the URL or path of the image to be displayed in the PopupNotify component.
|
|
@@ -12,7 +15,7 @@ export type PopupNotifyProps = {
|
|
|
12
15
|
/**
|
|
13
16
|
* `description`: Represents the description text to be displayed in the PopupNotify component.
|
|
14
17
|
*/
|
|
15
|
-
description: string;
|
|
18
|
+
description: string | React.ReactNode;
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* `information`: Optional. Represents additional information text to be displayed in the PopupNotify component.
|
|
@@ -67,4 +70,9 @@ type PopupAction = {
|
|
|
67
70
|
onPress: () => void;
|
|
68
71
|
};
|
|
69
72
|
|
|
73
|
+
export type HighlightText = {
|
|
74
|
+
text: string;
|
|
75
|
+
style: TextStyle;
|
|
76
|
+
};
|
|
77
|
+
|
|
70
78
|
type PopupActionDirection = 'row' | 'column' | 'auto';
|
package/Radio/index.tsx
CHANGED
package/Skeleton/types.ts
CHANGED
package/Text/index.tsx
CHANGED
|
@@ -3,7 +3,6 @@ import {Text as RNText, TextProps as RNTextProps} from 'react-native';
|
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import {Typography, TypographyWeight} from './types';
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
|
-
import {GridContext} from '../Layout';
|
|
7
6
|
import {scaleSize} from './utils';
|
|
8
7
|
|
|
9
8
|
const SFProText: TypographyWeight = {
|
|
@@ -51,22 +50,14 @@ export interface TextProps extends RNTextProps {
|
|
|
51
50
|
* It can be any valid color string (e.g., hex, rgb, rgba, etc.).
|
|
52
51
|
*/
|
|
53
52
|
color?: string;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Optional. Represents the width of the Text component in terms of span numbers.
|
|
57
|
-
* It can be used to set a specific width for the text based on a predefined grid system.
|
|
58
|
-
*/
|
|
59
|
-
widthSpan?: number;
|
|
60
53
|
}
|
|
61
54
|
const Text: React.FC<TextProps> = ({
|
|
62
55
|
typography,
|
|
63
56
|
color,
|
|
64
57
|
children,
|
|
65
58
|
style,
|
|
66
|
-
widthSpan,
|
|
67
59
|
...rest
|
|
68
60
|
}) => {
|
|
69
|
-
const grid = useContext(GridContext);
|
|
70
61
|
const {theme} = useContext(ApplicationContext);
|
|
71
62
|
|
|
72
63
|
const getTypoStyle = (typo: Typography) => {
|
|
@@ -101,17 +92,11 @@ const Text: React.FC<TextProps> = ({
|
|
|
101
92
|
};
|
|
102
93
|
|
|
103
94
|
const textStyle = getTypoStyle(typography);
|
|
104
|
-
const spanStyle = widthSpan ? {width: grid.getSizeSpan(widthSpan)} : {};
|
|
105
95
|
return (
|
|
106
96
|
<RNText
|
|
107
97
|
{...rest}
|
|
108
98
|
accessibilityLabel={`Text/${children}`}
|
|
109
|
-
style={[
|
|
110
|
-
style,
|
|
111
|
-
textStyle,
|
|
112
|
-
spanStyle,
|
|
113
|
-
{color: color ?? theme.colors.text.default},
|
|
114
|
-
]}>
|
|
99
|
+
style={[style, textStyle, {color: color ?? theme.colors.text.default}]}>
|
|
115
100
|
{children ?? ''}
|
|
116
101
|
</RNText>
|
|
117
102
|
);
|
package/Text/utils.ts
CHANGED
package/code-scanner.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const scanner = require('react-scanner');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const scan = async config => {
|
|
5
|
+
return await scanner.run(config);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const calcSum = array => {
|
|
9
|
+
return array.reduce((a, b) => a + b, 0);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const calculateAdoptionRate = (kitJsonPath, miniappJsonPath) => {
|
|
13
|
+
const kitJson = require(kitJsonPath);
|
|
14
|
+
const miniAppJson = require(miniappJsonPath);
|
|
15
|
+
const numOfKitComponents = calcSum(Object.values(kitJson));
|
|
16
|
+
const numOfMiniAppComponents = calcSum(Object.values(miniAppJson));
|
|
17
|
+
const adoptionRate = (numOfKitComponents / numOfMiniAppComponents) * 100;
|
|
18
|
+
console.log("Number of kit's components: ", numOfKitComponents);
|
|
19
|
+
console.log("Number of miniapp's components: ", numOfMiniAppComponents);
|
|
20
|
+
console.log('Adoption rate: ', adoptionRate);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const main = async () => {
|
|
24
|
+
const [scanPath, kitJsonRelativePath, miniappJsonRelativePath] =
|
|
25
|
+
process.argv.slice(2);
|
|
26
|
+
|
|
27
|
+
const kitJsonPath = path.resolve(process.cwd(), kitJsonRelativePath);
|
|
28
|
+
const miniappJsonPath = path.resolve(process.cwd(), miniappJsonRelativePath);
|
|
29
|
+
|
|
30
|
+
const config1 = {
|
|
31
|
+
crawlFrom: scanPath,
|
|
32
|
+
includeSubComponents: true,
|
|
33
|
+
importedFrom: /@momo-kits\/.+/,
|
|
34
|
+
processors: [['count-components', {outputTo: kitJsonPath}]],
|
|
35
|
+
rootDir: './',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const config2 = {
|
|
39
|
+
crawlFrom: scanPath,
|
|
40
|
+
includeSubComponents: true,
|
|
41
|
+
processors: [['count-components', {outputTo: miniappJsonPath}]],
|
|
42
|
+
rootDir: './',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
await scan(config1);
|
|
46
|
+
await scan(config2);
|
|
47
|
+
|
|
48
|
+
calculateAdoptionRate(kitJsonPath, miniappJsonPath);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
main().catch(console.error);
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.78.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -10,14 +10,17 @@
|
|
|
10
10
|
"@momo-kits/foundation"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
+
"@gorhom/bottom-sheet": "2.4.1",
|
|
13
14
|
"react-native-safe-area-context": "3.1.4",
|
|
14
15
|
"react-native-linear-gradient": "2.5.6",
|
|
16
|
+
"react-native-gesture-handler": "1.10.3",
|
|
17
|
+
"react-native-fast-image": "8.1.5",
|
|
15
18
|
"@react-navigation/bottom-tabs": "git+https://gitlab.com/dung.huynh1/react-navigation-bottom-tabs.git#main",
|
|
16
19
|
"@react-navigation/core": "5.16.1",
|
|
17
20
|
"@react-navigation/native": "5.9.8",
|
|
18
21
|
"@react-navigation/routers": "5.7.4",
|
|
19
|
-
"
|
|
20
|
-
"@
|
|
22
|
+
"lottie-react-native": "3.3.2",
|
|
23
|
+
"@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main"
|
|
21
24
|
},
|
|
22
25
|
"peerDependencies": {
|
|
23
26
|
"react-native": "*"
|
|
@@ -34,7 +37,8 @@
|
|
|
34
37
|
"jest": "^26.6.3",
|
|
35
38
|
"metro-react-native-babel-preset": "^0.64.0",
|
|
36
39
|
"react-test-renderer": "17.0.1",
|
|
37
|
-
"typescript": "^4.0.3"
|
|
40
|
+
"typescript": "^4.0.3",
|
|
41
|
+
"react-scanner": "^1.1.0"
|
|
38
42
|
},
|
|
39
43
|
"author": "@momo-kits/foundation",
|
|
40
44
|
"license": "ISC"
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"rootDir": ".",
|
|
4
|
+
"allowUnreachableCode": false,
|
|
5
|
+
"allowUnusedLabels": false,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"jsx": "react",
|
|
9
|
+
"lib": ["esnext"],
|
|
10
|
+
"module": "esnext",
|
|
11
|
+
"moduleResolution": "node",
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"noImplicitReturns": false,
|
|
14
|
+
"noImplicitUseStrict": false,
|
|
15
|
+
"noStrictGenericChecks": false,
|
|
16
|
+
"noUncheckedIndexedAccess": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"resolveJsonModule": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"strict": true,
|
|
22
|
+
"target": "esnext",
|
|
23
|
+
"verbatimModuleSyntax": false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import {Platform, StyleSheet, TouchableOpacity as TouchRN} from 'react-native';
|
|
2
|
-
import {TouchableOpacity as TouchGesture} from 'react-native-gesture-handler';
|
|
3
|
-
import React, {useContext} from 'react';
|
|
4
|
-
import {NavigationButtonProps} from './types';
|
|
5
|
-
import {ApplicationContext} from './index';
|
|
6
|
-
import {Icon} from '../Icon';
|
|
7
|
-
import {Colors} from '../Consts';
|
|
8
|
-
|
|
9
|
-
const TouchableOpacity = Platform.OS === 'ios' ? TouchRN : TouchGesture;
|
|
10
|
-
const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
11
|
-
icon,
|
|
12
|
-
tintColor,
|
|
13
|
-
onPress,
|
|
14
|
-
backgroundColor,
|
|
15
|
-
useBorder = true,
|
|
16
|
-
accessibilityLabel,
|
|
17
|
-
}) => {
|
|
18
|
-
const {theme} = useContext(ApplicationContext);
|
|
19
|
-
if (!backgroundColor && tintColor != Colors.black_01) {
|
|
20
|
-
backgroundColor = theme.colors.background.surface;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<TouchableOpacity
|
|
25
|
-
accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
|
|
26
|
-
style={[
|
|
27
|
-
styles.container,
|
|
28
|
-
{
|
|
29
|
-
backgroundColor: backgroundColor ?? '#00000066',
|
|
30
|
-
borderWidth: useBorder && backgroundColor ? 0.5 : 0,
|
|
31
|
-
},
|
|
32
|
-
]}
|
|
33
|
-
onPress={onPress}>
|
|
34
|
-
<Icon
|
|
35
|
-
source={icon}
|
|
36
|
-
color={tintColor ?? theme.colors.text.default}
|
|
37
|
-
size={20}
|
|
38
|
-
/>
|
|
39
|
-
</TouchableOpacity>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const styles = StyleSheet.create({
|
|
44
|
-
container: {
|
|
45
|
-
height: 28,
|
|
46
|
-
width: 28,
|
|
47
|
-
borderRadius: 14,
|
|
48
|
-
borderColor: '#00000066',
|
|
49
|
-
justifyContent: 'center',
|
|
50
|
-
alignItems: 'center',
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export default NavigationButton;
|