@momo-kits/foundation 0.75.1-beta.13 → 0.75.1-beta.14
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/Assets/icon.json +6 -0
- package/Layout/Card.tsx +1 -1
- package/Layout/GridSystem.tsx +1 -1
- package/Layout/Item.tsx +2 -2
- package/Layout/ScreenContainer.tsx +5 -4
- package/Layout/Section.tsx +7 -2
- package/Layout/types.ts +3 -1
- package/Layout/utils.ts +1 -2
- package/Navigation/Components.tsx +11 -8
- package/package.json +1 -1
package/Assets/icon.json
CHANGED
|
@@ -3943,5 +3943,11 @@
|
|
|
3943
3943
|
},
|
|
3944
3944
|
"ic_minus": {
|
|
3945
3945
|
"uri": "https://img.mservice.com.vn/app/img/kits/minus.png"
|
|
3946
|
+
},
|
|
3947
|
+
"ic_navigation": {
|
|
3948
|
+
"uri": "https://static.momocdn.net/app/img/kits/ic_navigation.png"
|
|
3949
|
+
},
|
|
3950
|
+
"ic_money_bag": {
|
|
3951
|
+
"uri": "https://static.momocdn.net/app/img/kits/ic_money_bag.png"
|
|
3946
3952
|
}
|
|
3947
3953
|
}
|
package/Layout/Card.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {GRIDVIEW} from '../Consts';
|
|
|
7
7
|
import Item from './Item';
|
|
8
8
|
|
|
9
9
|
const Card: React.FC<CardProps> = ({children, style}) => {
|
|
10
|
-
const numberOfColumns = 12;
|
|
10
|
+
const numberOfColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
11
11
|
const gutterSize = 8;
|
|
12
12
|
const margin = 12;
|
|
13
13
|
|
package/Layout/GridSystem.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {GridContextProps} from './types';
|
|
|
7
7
|
|
|
8
8
|
const GridSystem: React.FC = () => {
|
|
9
9
|
const {theme} = useContext(ApplicationContext);
|
|
10
|
-
const numberOfColumns = 12;
|
|
10
|
+
const numberOfColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
11
11
|
const gutterSize = 12;
|
|
12
12
|
const margin = 12;
|
|
13
13
|
const widthSection = Dimensions.get('window').width - margin * 2;
|
package/Layout/Item.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {GridContext} from './index';
|
|
|
6
6
|
import {GRIDVIEW} from '../Consts';
|
|
7
7
|
|
|
8
8
|
const Item: React.FC<ItemProps> = ({
|
|
9
|
-
widthSpan
|
|
9
|
+
widthSpan,
|
|
10
10
|
heightSpan,
|
|
11
11
|
children,
|
|
12
12
|
style,
|
|
@@ -39,7 +39,7 @@ const Item: React.FC<ItemProps> = ({
|
|
|
39
39
|
style={[
|
|
40
40
|
style,
|
|
41
41
|
{
|
|
42
|
-
width: grid.getSizeSpan(widthSpan),
|
|
42
|
+
width: grid.getSizeSpan(widthSpan ?? grid.numberOfColumns),
|
|
43
43
|
height: heightSpan ? grid.getSizeSpan(heightSpan) : undefined,
|
|
44
44
|
overflow: 'hidden',
|
|
45
45
|
margin: undefined,
|
|
@@ -4,7 +4,7 @@ import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
|
4
4
|
import React, {useContext} from 'react';
|
|
5
5
|
import {ScreenContainerProps} from '../Navigation/types';
|
|
6
6
|
import {Spacing, Styles} from '../Consts';
|
|
7
|
-
import {
|
|
7
|
+
import {Card, Section, validateChildren} from './index';
|
|
8
8
|
import {ApplicationContext} from '../Navigation';
|
|
9
9
|
|
|
10
10
|
const ScreenContainer: React.FC<ScreenContainerProps> = ({
|
|
@@ -78,8 +78,9 @@ const ScreenContainer: React.FC<ScreenContainerProps> = ({
|
|
|
78
78
|
<View
|
|
79
79
|
style={{
|
|
80
80
|
position: 'absolute',
|
|
81
|
-
|
|
81
|
+
maxHeight: 215,
|
|
82
82
|
width: '100%',
|
|
83
|
+
overflow: 'hidden',
|
|
83
84
|
}}>
|
|
84
85
|
{!!headerBackground && (
|
|
85
86
|
<Animated.Image
|
|
@@ -88,7 +89,7 @@ const ScreenContainer: React.FC<ScreenContainerProps> = ({
|
|
|
88
89
|
}}
|
|
89
90
|
style={{
|
|
90
91
|
opacity: opacity ?? 1,
|
|
91
|
-
aspectRatio: 1.
|
|
92
|
+
aspectRatio: 1.75,
|
|
92
93
|
...imageAnimatedStyle,
|
|
93
94
|
}}
|
|
94
95
|
/>
|
|
@@ -111,7 +112,7 @@ const ScreenContainer: React.FC<ScreenContainerProps> = ({
|
|
|
111
112
|
<View
|
|
112
113
|
style={{
|
|
113
114
|
paddingTop: Spacing.S,
|
|
114
|
-
paddingBottom: insets.bottom,
|
|
115
|
+
paddingBottom: insets.bottom + Spacing.S,
|
|
115
116
|
backgroundColor: theme.colors.background.surface,
|
|
116
117
|
}}>
|
|
117
118
|
<Section>{Footer}</Section>
|
package/Layout/Section.tsx
CHANGED
|
@@ -6,8 +6,12 @@ import {GridContext} from './index';
|
|
|
6
6
|
import {GRIDVIEW} from '../Consts';
|
|
7
7
|
import Item from './Item';
|
|
8
8
|
|
|
9
|
-
const Section: React.FC<SectionProps> = ({
|
|
10
|
-
|
|
9
|
+
const Section: React.FC<SectionProps> = ({
|
|
10
|
+
children,
|
|
11
|
+
useMargin = true,
|
|
12
|
+
backgroundColor,
|
|
13
|
+
}) => {
|
|
14
|
+
const numberOfColumns = Dimensions.get('window').width > 600 ? 24 : 12;
|
|
11
15
|
const gutterSize = 12;
|
|
12
16
|
let margin = 0;
|
|
13
17
|
if (useMargin) {
|
|
@@ -128,6 +132,7 @@ const Section: React.FC<SectionProps> = ({children, useMargin = true}) => {
|
|
|
128
132
|
marginHorizontal: gridContext.margin,
|
|
129
133
|
flexDirection: 'row',
|
|
130
134
|
flexWrap: 'wrap',
|
|
135
|
+
backgroundColor: backgroundColor,
|
|
131
136
|
}}>
|
|
132
137
|
{renderView(validateChildren(children, [Item]))}
|
|
133
138
|
{GRIDVIEW && renderOverlay()}
|
package/Layout/types.ts
CHANGED
|
@@ -40,13 +40,15 @@ export interface SectionProps extends ViewProps {
|
|
|
40
40
|
* Defaults to `false` if not provided.
|
|
41
41
|
*/
|
|
42
42
|
useMargin?: boolean;
|
|
43
|
+
|
|
44
|
+
backgroundColor?: string;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
export interface ItemProps extends ViewProps {
|
|
46
48
|
/**
|
|
47
49
|
* Represents the width of the Card component in terms of span numbers (1-12).
|
|
48
50
|
*/
|
|
49
|
-
widthSpan
|
|
51
|
+
widthSpan?: SpanNumber;
|
|
50
52
|
|
|
51
53
|
/**
|
|
52
54
|
* Optional. Represents the height of the Card component in terms of span numbers (1-12).
|
package/Layout/utils.ts
CHANGED
|
@@ -44,12 +44,13 @@ const styles = StyleSheet.create({
|
|
|
44
44
|
borderWidth: 1,
|
|
45
45
|
borderColor: Colors.black_01,
|
|
46
46
|
},
|
|
47
|
+
headerButton: {paddingHorizontal: 4},
|
|
47
48
|
headerRightButton: {
|
|
48
49
|
flexDirection: 'row',
|
|
49
50
|
overflow: 'hidden',
|
|
50
51
|
justifyContent: 'center',
|
|
51
52
|
alignItems: 'center',
|
|
52
|
-
paddingRight: Spacing.
|
|
53
|
+
paddingRight: Spacing.S,
|
|
53
54
|
},
|
|
54
55
|
toolkitContainer: {
|
|
55
56
|
marginLeft: Spacing.S,
|
|
@@ -214,7 +215,7 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
|
|
|
214
215
|
|
|
215
216
|
const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
|
|
216
217
|
const validType = (item: any) => {
|
|
217
|
-
if (item.type !== NavigationButton) {
|
|
218
|
+
if (__DEV__ && item.type !== NavigationButton) {
|
|
218
219
|
console.warn(
|
|
219
220
|
'element type of NavigationButton, Please migrate to use NavigationButton of kits.',
|
|
220
221
|
);
|
|
@@ -224,19 +225,21 @@ const HeaderRightAction: React.FC<any> = ({children, ...restProps}) => {
|
|
|
224
225
|
const renderAction = () => {
|
|
225
226
|
if (Array.isArray(children)) {
|
|
226
227
|
return children.map((child, index) => {
|
|
227
|
-
|
|
228
|
-
validType(child);
|
|
229
|
-
}
|
|
228
|
+
validType(child);
|
|
230
229
|
return (
|
|
231
|
-
<
|
|
230
|
+
<View key={index} style={styles.headerButton}>
|
|
232
231
|
{React.cloneElement(child, {...restProps})}
|
|
233
|
-
</
|
|
232
|
+
</View>
|
|
234
233
|
);
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
236
|
|
|
238
237
|
validType(children);
|
|
239
|
-
return
|
|
238
|
+
return (
|
|
239
|
+
<View style={styles.headerButton}>
|
|
240
|
+
{React.cloneElement(children, {...restProps})}
|
|
241
|
+
</View>
|
|
242
|
+
);
|
|
240
243
|
};
|
|
241
244
|
return <View style={styles.headerRightButton}>{renderAction()}</View>;
|
|
242
245
|
};
|