@momo-kits/foundation 0.81.5 → 0.81.7
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/types.ts +0 -2
- package/Input/InputOTP.tsx +1 -1
- package/Layout/Item.tsx +1 -1
- package/Layout/ItemList.tsx +27 -25
- package/package.json +3 -2
- 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'}>
|
package/Application/types.ts
CHANGED
|
@@ -125,9 +125,7 @@ export interface NavigationOptions extends StackNavigationOptions {
|
|
|
125
125
|
onPressLeftHeader?: () => void;
|
|
126
126
|
surface?: boolean;
|
|
127
127
|
hiddenBack?: boolean;
|
|
128
|
-
headerTitleAlign?: 'left' | 'center';
|
|
129
128
|
customTitle?: TitleCustomProps;
|
|
130
|
-
animatedValue?: Animated.Value;
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
export interface HeaderBackProps extends NavigationButtonProps {
|
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.7",
|
|
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",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"metro-react-native-babel-preset": "^0.64.0",
|
|
39
39
|
"react-test-renderer": "17.0.1",
|
|
40
40
|
"typescript": "^4.0.3",
|
|
41
|
+
"@momo-platform/versions": "4.1.11",
|
|
41
42
|
"react-scanner": "^1.1.0"
|
|
42
43
|
},
|
|
43
44
|
"author": "@momo-kits/foundation",
|