@momo-kits/foundation 0.81.5-beta.1 → 0.81.6
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/Components.tsx +10 -11
- package/Application/ModalScreen.tsx +1 -1
- package/Application/NavigationContainer.tsx +0 -2
- package/Application/StackScreen.tsx +3 -28
- package/Application/types.ts +1 -10
- package/Input/InputOTP.tsx +1 -1
- package/Layout/Item.tsx +1 -1
- package/Layout/ItemList.tsx +27 -25
- package/package.json +3 -3
- package/tsconfig.json +0 -1
|
@@ -2,13 +2,11 @@ import React, {Fragment, useContext, useEffect, useState} from 'react';
|
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
DeviceEventEmitter,
|
|
5
|
-
Platform,
|
|
6
5
|
StatusBar,
|
|
7
6
|
StyleSheet,
|
|
8
7
|
TouchableOpacity,
|
|
9
8
|
View,
|
|
10
9
|
} from 'react-native';
|
|
11
|
-
import {TouchableOpacity as TouchableGesture} from 'react-native-gesture-handler';
|
|
12
10
|
import {ApplicationContext} from './index';
|
|
13
11
|
import {Colors, Radius, Spacing, Styles} from '../Consts';
|
|
14
12
|
import {Image} from '../Image';
|
|
@@ -24,9 +22,6 @@ import {scaleSize, Text} from '../Text';
|
|
|
24
22
|
import {Icon} from '../Icon';
|
|
25
23
|
import {PopupNotify} from '../Popup';
|
|
26
24
|
|
|
27
|
-
const Touchable =
|
|
28
|
-
Platform.OS === 'android' ? TouchableGesture : TouchableOpacity;
|
|
29
|
-
|
|
30
25
|
const styles = StyleSheet.create({
|
|
31
26
|
navigationButton: {
|
|
32
27
|
height: 28,
|
|
@@ -106,7 +101,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
106
101
|
}
|
|
107
102
|
|
|
108
103
|
return (
|
|
109
|
-
<
|
|
104
|
+
<TouchableOpacity
|
|
110
105
|
accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
|
|
111
106
|
style={[
|
|
112
107
|
styles.navigationButton,
|
|
@@ -121,7 +116,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
121
116
|
color={tintColor ?? theme.colors.text.default}
|
|
122
117
|
size={20}
|
|
123
118
|
/>
|
|
124
|
-
</
|
|
119
|
+
</TouchableOpacity>
|
|
125
120
|
);
|
|
126
121
|
};
|
|
127
122
|
|
|
@@ -397,17 +392,21 @@ const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
|
|
|
397
392
|
borderWidth: backgroundColor ? 0.5 : 0,
|
|
398
393
|
},
|
|
399
394
|
]}>
|
|
400
|
-
<
|
|
395
|
+
<TouchableOpacity
|
|
396
|
+
accessibilityLabel={'Toolkit/More'}
|
|
397
|
+
onPress={onMore}>
|
|
401
398
|
<Icon color={tintColor} source="navigation_more_horiz" size={20} />
|
|
402
|
-
</
|
|
399
|
+
</TouchableOpacity>
|
|
403
400
|
<View style={[styles.divider, {backgroundColor: tintColor}]} />
|
|
404
|
-
<
|
|
401
|
+
<TouchableOpacity
|
|
402
|
+
accessibilityLabel={`Toolkit/Close`}
|
|
403
|
+
onPress={onClose}>
|
|
405
404
|
<Icon
|
|
406
405
|
color={tintColor}
|
|
407
406
|
source="16_navigation_close_circle"
|
|
408
407
|
size={20}
|
|
409
408
|
/>
|
|
410
|
-
</
|
|
409
|
+
</TouchableOpacity>
|
|
411
410
|
</View>
|
|
412
411
|
</View>
|
|
413
412
|
);
|
|
@@ -160,7 +160,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
160
160
|
navigator?.pop();
|
|
161
161
|
}
|
|
162
162
|
}}
|
|
163
|
-
bottomInset={bottomInset}
|
|
163
|
+
bottomInset={Platform.OS === 'ios' ? bottomInset : 0}
|
|
164
164
|
handleComponent={null}
|
|
165
165
|
backdropComponent={backdropComponent}>
|
|
166
166
|
<BottomSheetView accessibilityLabel={'BottomSheet'}>
|
|
@@ -23,7 +23,6 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
23
23
|
options,
|
|
24
24
|
maxApi,
|
|
25
25
|
localization,
|
|
26
|
-
miniAppInfo,
|
|
27
26
|
}) => {
|
|
28
27
|
const navigationRef = React.useRef<NavigationContainerRef>(null);
|
|
29
28
|
const navigator = useRef(new Navigator(navigationRef));
|
|
@@ -74,7 +73,6 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
74
73
|
showGrid,
|
|
75
74
|
language,
|
|
76
75
|
translate,
|
|
77
|
-
appInfo: miniAppInfo,
|
|
78
76
|
}}>
|
|
79
77
|
<ReactNavigationContainer
|
|
80
78
|
theme={{
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
import React, {useContext,
|
|
1
|
+
import React, {useContext, useLayoutEffect} from 'react';
|
|
2
2
|
import {ScreenParams} from './types';
|
|
3
3
|
import Navigation from './Navigation';
|
|
4
4
|
import {ApplicationContext} from './index';
|
|
5
5
|
import {GridSystem} from '../Layout';
|
|
6
6
|
|
|
7
|
-
const TRIGGER_ID = '111378000000000000';
|
|
8
|
-
|
|
9
7
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
10
|
-
const {
|
|
11
|
-
|
|
12
|
-
options,
|
|
13
|
-
tracking,
|
|
14
|
-
}: ScreenParams = props.route.params;
|
|
15
|
-
const {theme, showGrid, navigator, appInfo} = useContext(ApplicationContext);
|
|
8
|
+
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
9
|
+
const {theme, showGrid} = useContext(ApplicationContext);
|
|
16
10
|
const navigation = new Navigation(props.navigation, theme);
|
|
17
11
|
|
|
18
12
|
const params = {
|
|
@@ -22,25 +16,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
22
16
|
|
|
23
17
|
delete params.screen;
|
|
24
18
|
|
|
25
|
-
const navigationRoutes = props.navigation.getState()?.routes || [];
|
|
26
|
-
const routesLength = navigationRoutes.length;
|
|
27
|
-
let pre_screen_name = navigationRoutes?.[0]?.params?.screen?.name;
|
|
28
|
-
if (routesLength > 1) {
|
|
29
|
-
pre_screen_name = navigationRoutes[routesLength - 2]?.params?.screen?.name;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (appInfo) {
|
|
34
|
-
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
35
|
-
...appInfo,
|
|
36
|
-
screen_name: Component.name,
|
|
37
|
-
flow_partner_id: tracking?.flow_partner_id,
|
|
38
|
-
pre_screen_name,
|
|
39
|
-
trigger_id: TRIGGER_ID,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
19
|
useLayoutEffect(() => {
|
|
45
20
|
if (options) {
|
|
46
21
|
navigation.setOptions(options);
|
package/Application/types.ts
CHANGED
|
@@ -68,7 +68,6 @@ export type Context = {
|
|
|
68
68
|
showGrid?: boolean;
|
|
69
69
|
language?: 'vi' | 'en';
|
|
70
70
|
translate?: (key: string) => string;
|
|
71
|
-
appInfo: MiniAppInfo;
|
|
72
71
|
};
|
|
73
72
|
|
|
74
73
|
export type LocalizationObject = {
|
|
@@ -80,19 +79,12 @@ export type LocalizationObject = {
|
|
|
80
79
|
};
|
|
81
80
|
};
|
|
82
81
|
|
|
83
|
-
export type MiniAppInfo = {
|
|
84
|
-
feature_code: string;
|
|
85
|
-
app_id: string;
|
|
86
|
-
miniapp_version: number;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
82
|
export type NavigationContainerProps = {
|
|
90
83
|
screen: Screen;
|
|
91
84
|
options?: NavigationOptions;
|
|
92
85
|
theme: Theme;
|
|
93
|
-
maxApi
|
|
86
|
+
maxApi?: any;
|
|
94
87
|
localization?: LocalizationObject;
|
|
95
|
-
miniAppInfo: MiniAppInfo;
|
|
96
88
|
};
|
|
97
89
|
|
|
98
90
|
export type NavigationScreenProps = {
|
|
@@ -105,7 +97,6 @@ export type ScreenParams = {
|
|
|
105
97
|
[key: string]: any;
|
|
106
98
|
screen: Screen;
|
|
107
99
|
options?: NavigationOptions;
|
|
108
|
-
tracking?: any;
|
|
109
100
|
};
|
|
110
101
|
|
|
111
102
|
export interface ModalParams extends ScreenParams {
|
package/Input/InputOTP.tsx
CHANGED
package/Layout/Item.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {GridContext} from './index';
|
|
|
5
5
|
import {ApplicationContext} from '../Application';
|
|
6
6
|
import styles from './styles';
|
|
7
7
|
|
|
8
|
-
type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
8
|
+
export type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
9
|
|
|
10
10
|
export interface ItemProps extends ViewProps {
|
|
11
11
|
/**
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import React, {FC,
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {FlatList, FlatListProps, View} from 'react-native';
|
|
3
|
-
import Item from './Item';
|
|
3
|
+
import Item, {SpanNumber} from './Item';
|
|
4
4
|
import {GridContext} from './index';
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export interface ItemListProps extends FlatListProps<any> {
|
|
8
|
+
/**
|
|
9
|
+
* Require key support number columns change grid system
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
key: string;
|
|
13
|
+
/**
|
|
14
|
+
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
15
|
+
*/
|
|
16
|
+
widthSpan?: SpanNumber;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const ItemList: FC<ItemListProps> = ({
|
|
20
|
+
key,
|
|
8
21
|
renderItem,
|
|
9
|
-
|
|
22
|
+
widthSpan,
|
|
10
23
|
style,
|
|
11
24
|
contentContainerStyle,
|
|
12
25
|
...props
|
|
13
26
|
}) => {
|
|
14
|
-
const {gutterSize} = useContext(GridContext);
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
item
|
|
21
|
-
index,
|
|
22
|
-
separators,
|
|
23
|
-
}) as ReactElement;
|
|
24
|
-
|
|
25
|
-
if (children?.type !== Item) {
|
|
26
|
-
console.warn('Wrong children type for this component, expected are Item');
|
|
27
|
+
const {gutterSize, numberOfColumns} = useContext(GridContext);
|
|
28
|
+
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
29
|
+
const numColumns = Math.floor(numberOfColumns / widthItem);
|
|
30
|
+
const indexBegin = props?.data?.map((_i, index) => index * numColumns);
|
|
31
|
+
const _renderItem = (item: any) => {
|
|
32
|
+
if (indexBegin?.includes(item?.index)) {
|
|
33
|
+
return <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>;
|
|
27
34
|
}
|
|
28
|
-
|
|
29
35
|
return (
|
|
30
|
-
<View
|
|
31
|
-
|
|
32
|
-
numColumns > 1 && {
|
|
33
|
-
marginRight: gutterSize,
|
|
34
|
-
}
|
|
35
|
-
}>
|
|
36
|
-
{children}
|
|
36
|
+
<View style={{paddingLeft: gutterSize}}>
|
|
37
|
+
<Item widthSpan={widthItem}>{renderItem?.(item)}</Item>
|
|
37
38
|
</View>
|
|
38
39
|
);
|
|
39
40
|
};
|
|
@@ -41,6 +42,7 @@ const ItemList: FC<FlatListProps<any>> = ({
|
|
|
41
42
|
return (
|
|
42
43
|
<FlatList
|
|
43
44
|
{...props}
|
|
45
|
+
key={`${key ?? 'ItemList'}${numColumns}}`}
|
|
44
46
|
numColumns={numColumns}
|
|
45
47
|
renderItem={_renderItem}
|
|
46
48
|
horizontal={false}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.6",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"@momo-kits/foundation"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@gorhom/bottom-sheet": "
|
|
13
|
+
"@gorhom/bottom-sheet": "git+https://gitlab.com/dung.huynh1/bottom-sheet.git#main",
|
|
14
14
|
"react-native-safe-area-context": "3.1.4",
|
|
15
15
|
"react-native-linear-gradient": "2.5.6",
|
|
16
16
|
"react-native-gesture-handler": "1.10.3",
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
},
|
|
43
43
|
"author": "@momo-kits/foundation",
|
|
44
44
|
"license": "ISC"
|
|
45
|
-
}
|
|
45
|
+
}
|