@momo-kits/foundation 0.77.4 → 0.77.5

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.
@@ -84,6 +84,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
84
84
  ),
85
85
  };
86
86
  }
87
+
87
88
  if (params.surface == true) {
88
89
  options = {
89
90
  ...options,
@@ -125,6 +126,13 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
125
126
  };
126
127
  }
127
128
 
129
+ if (params?.headerRight == undefined) {
130
+ options = {
131
+ ...options,
132
+ headerRight: (props: any) => <HeaderToolkitAction {...props} />,
133
+ };
134
+ }
135
+
128
136
  return {
129
137
  ...params,
130
138
  ...options,
package/Layout/Card.tsx CHANGED
@@ -2,11 +2,12 @@ import React, {useContext} from 'react';
2
2
  import {Dimensions, View} from 'react-native';
3
3
  import {useGridSystem, validateChildren} from './utils';
4
4
  import {CardProps, GridContextProps} from './types';
5
- import {GridContext} from './index';
5
+ import {GridContext, GridSystem} from './index';
6
6
  import Item from './Item';
7
7
  import {Image} from '../Image';
8
8
  import {ApplicationContext} from '../Application';
9
9
  import styles from './styles';
10
+ import {Colors, Spacing} from '../Consts';
10
11
 
11
12
  const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
12
13
  const {showGrid} = useContext(ApplicationContext);
@@ -32,7 +33,17 @@ const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
32
33
  * render overlay only dev mode
33
34
  */
34
35
  const renderOverlay = () => {
35
- return <View pointerEvents={'none'} style={styles.boxGrid} />;
36
+ return (
37
+ <>
38
+ <GridSystem
39
+ width={widthSection}
40
+ gutterSize={Spacing.S}
41
+ screenGrid={false}
42
+ gridColor={Colors.red_01}
43
+ />
44
+ <View pointerEvents={'none'} style={styles.boxGridCard} />
45
+ </>
46
+ );
36
47
  };
37
48
 
38
49
  /**
@@ -6,13 +6,18 @@ import {Colors, Spacing} from '../Consts';
6
6
  import {GridContextProps} from './types';
7
7
  import {useGridSystem} from './utils';
8
8
 
9
- const GridSystem: React.FC = () => {
9
+ const GridSystem: React.FC<any> = ({
10
+ width = Dimensions.get('window').width,
11
+ useMargin = true,
12
+ gutterSize = Spacing.M,
13
+ screenGrid = true,
14
+ gridColor = Colors.blue_07,
15
+ }) => {
10
16
  const {theme} = useContext(ApplicationContext);
11
17
  const {numberOfColumns} = useGridSystem();
12
18
 
13
- const gutterSize = 12;
14
- const margin = 12;
15
- const widthSection = Dimensions.get('window').width - margin * 2;
19
+ const margin = useMargin ? Spacing.M : 0;
20
+ const widthSection = width - margin * 2;
16
21
  const totalGutterSize = gutterSize * (numberOfColumns - 1);
17
22
  const sizePerSpan = (widthSection - totalGutterSize) / numberOfColumns;
18
23
 
@@ -38,11 +43,12 @@ const GridSystem: React.FC = () => {
38
43
  pointerEvents="none"
39
44
  style={[
40
45
  styles.gridContainer,
41
- insets,
46
+ screenGrid && insets,
42
47
  {
43
48
  borderColor: theme.colors.error.primary,
44
49
  marginHorizontal: grid.margin,
45
50
  top: Spacing.M,
51
+ bottom: Spacing.M,
46
52
  },
47
53
  ]}>
48
54
  {list.map((i, index) => {
@@ -50,12 +56,13 @@ const GridSystem: React.FC = () => {
50
56
  <View style={{flexDirection: 'row'}} key={index.toString()}>
51
57
  {index != -0 && <View style={{width: grid.gutterSize}} />}
52
58
  <View
53
- key={index.toString()}
59
+ key={`Grid${index.toString()}`}
54
60
  pointerEvents="none"
55
61
  style={[
56
62
  styles.gridColumn,
57
63
  {
58
64
  width: grid.sizePerSpan,
65
+ backgroundColor: gridColor,
59
66
  },
60
67
  ]}
61
68
  />
@@ -63,16 +70,20 @@ const GridSystem: React.FC = () => {
63
70
  );
64
71
  })}
65
72
  </View>
66
- <View pointerEvents="none" style={styles.dangerLeftContainer} />
67
- <View pointerEvents="none" style={styles.dangerRightContainer} />
68
- <View
69
- pointerEvents="none"
70
- style={[styles.dangerTopContainer, {height: Spacing.M}]}
71
- />
72
- <View
73
- pointerEvents="none"
74
- style={[styles.dangerBottomContainer, {height: insets.bottom}]}
75
- />
73
+ {screenGrid && (
74
+ <>
75
+ <View pointerEvents="none" style={styles.dangerLeftContainer} />
76
+ <View pointerEvents="none" style={styles.dangerRightContainer} />
77
+ <View
78
+ pointerEvents="none"
79
+ style={[styles.dangerTopContainer, {height: Spacing.M}]}
80
+ />
81
+ <View
82
+ pointerEvents="none"
83
+ style={[styles.dangerBottomContainer, {height: insets.bottom}]}
84
+ />
85
+ </>
86
+ )}
76
87
  </>
77
88
  );
78
89
  };
@@ -90,7 +101,6 @@ const styles = StyleSheet.create({
90
101
  gridColumn: {
91
102
  height: '100%',
92
103
  opacity: 0.2,
93
- backgroundColor: Colors.blue_07,
94
104
  },
95
105
  dangerTopContainer: {
96
106
  opacity: 0.2,
@@ -39,7 +39,7 @@ const Section: React.FC<SectionProps> = ({
39
39
  * render overlay only dev mode
40
40
  */
41
41
  const renderOverlay = () => {
42
- return <View pointerEvents={'none'} style={styles.boxGrid} />;
42
+ return <View pointerEvents={'none'} style={styles.boxGridSection} />;
43
43
  };
44
44
 
45
45
  /**
package/Layout/styles.ts CHANGED
@@ -9,6 +9,27 @@ export default StyleSheet.create({
9
9
  right: 0,
10
10
  borderColor: 'red',
11
11
  borderWidth: 1,
12
+ zIndex: 99,
13
+ },
14
+ boxGridSection: {
15
+ position: 'absolute',
16
+ top: 0,
17
+ bottom: 0,
18
+ left: 0,
19
+ right: 0,
20
+ borderColor: 'blue',
21
+ borderWidth: 2,
22
+ zIndex: 100,
23
+ },
24
+ boxGridCard: {
25
+ position: 'absolute',
26
+ top: 0,
27
+ bottom: 0,
28
+ left: 0,
29
+ right: 0,
30
+ borderColor: 'green',
31
+ borderWidth: 2,
32
+ zIndex: 100,
12
33
  },
13
34
  card: {
14
35
  flexDirection: 'row',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.77.4",
3
+ "version": "0.77.5",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {