@momo-kits/foundation 0.77.3 → 0.77.4

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.
@@ -1,14 +1,14 @@
1
- import React, {FC, useContext} from 'react';
1
+ import React, {useContext} from 'react';
2
+ import {View} from 'react-native';
2
3
  import {BottomTabProps} from './types';
3
4
  import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
4
5
  import {Icon} from '../Icon';
5
6
  import {Text} from '../Text';
6
7
  import {ApplicationContext} from './index';
7
- import {View} from 'react-native';
8
8
 
9
9
  const Tab = createBottomTabNavigator();
10
10
 
11
- const BottomTab: FC<BottomTabProps> = ({tabs, listeners}) => {
11
+ const BottomTab: React.FC<BottomTabProps> = ({tabs, listeners}) => {
12
12
  const {theme} = useContext(ApplicationContext);
13
13
  return (
14
14
  <Tab.Navigator>
@@ -166,7 +166,7 @@ export type BottomTabItemProps = {
166
166
  icon: string;
167
167
  showDot?: boolean;
168
168
  badgeLabel?: string;
169
- screen: React.ComponentType;
169
+ screen: Screen;
170
170
  };
171
171
 
172
172
  export type BottomTabProps = {
package/Layout/Card.tsx CHANGED
@@ -4,9 +4,11 @@ import {useGridSystem, validateChildren} from './utils';
4
4
  import {CardProps, GridContextProps} from './types';
5
5
  import {GridContext} from './index';
6
6
  import Item from './Item';
7
+ import {Image} from '../Image';
7
8
  import {ApplicationContext} from '../Application';
9
+ import styles from './styles';
8
10
 
9
- const Card: React.FC<CardProps> = ({children, style}) => {
11
+ const Card: React.FC<CardProps> = ({children, style, backgroundImage}) => {
10
12
  const {showGrid} = useContext(ApplicationContext);
11
13
  const {numberOfColumns} = useGridSystem();
12
14
 
@@ -30,20 +32,7 @@ const Card: React.FC<CardProps> = ({children, style}) => {
30
32
  * render overlay only dev mode
31
33
  */
32
34
  const renderOverlay = () => {
33
- return (
34
- <View
35
- pointerEvents={'none'}
36
- style={{
37
- position: 'absolute',
38
- top: 0,
39
- bottom: 0,
40
- left: 0,
41
- right: 0,
42
- borderColor: 'red',
43
- borderWidth: 1,
44
- }}
45
- />
46
- );
35
+ return <View pointerEvents={'none'} style={styles.boxGrid} />;
47
36
  };
48
37
 
49
38
  /**
@@ -123,14 +112,18 @@ const Card: React.FC<CardProps> = ({children, style}) => {
123
112
  accessibilityLabel={`Card`}
124
113
  style={[
125
114
  style,
115
+ styles.card,
126
116
  {
127
117
  width: widthSection,
128
118
  marginHorizontal: gridContext.margin,
129
- padding: 12,
130
- flexDirection: 'row',
131
- flexWrap: 'wrap',
132
119
  },
133
120
  ]}>
121
+ {!!backgroundImage && (
122
+ <Image
123
+ source={{uri: backgroundImage}}
124
+ style={[style, styles.cardImage]}
125
+ />
126
+ )}
134
127
  {renderView(validateChildren(children, [Item]))}
135
128
  {showGrid && renderOverlay()}
136
129
  </View>
package/Layout/Item.tsx CHANGED
@@ -4,6 +4,7 @@ import {View} from 'react-native';
4
4
  import {ItemProps} from './types';
5
5
  import {GridContext} from './index';
6
6
  import {ApplicationContext} from '../Application';
7
+ import styles from './styles';
7
8
 
8
9
  const Item: React.FC<ItemProps> = ({
9
10
  widthSpan,
@@ -18,20 +19,7 @@ const Item: React.FC<ItemProps> = ({
18
19
  * render overlay view only dev mode
19
20
  */
20
21
  const renderOverlay = () => {
21
- return (
22
- <View
23
- pointerEvents={'none'}
24
- style={{
25
- position: 'absolute',
26
- top: 0,
27
- bottom: 0,
28
- left: 0,
29
- right: 0,
30
- borderColor: 'red',
31
- borderWidth: 1,
32
- }}
33
- />
34
- );
22
+ return <View pointerEvents={'none'} style={styles.boxGrid} />;
35
23
  };
36
24
 
37
25
  return (
@@ -39,15 +27,10 @@ const Item: React.FC<ItemProps> = ({
39
27
  accessibilityLabel={`Item`}
40
28
  style={[
41
29
  style,
30
+ styles.item,
42
31
  {
43
32
  width: grid.getSizeSpan(widthSpan ?? grid.numberOfColumns),
44
33
  height: heightSpan ? grid.getSizeSpan(heightSpan) : undefined,
45
- overflow: 'hidden',
46
- margin: undefined,
47
- marginTop: undefined,
48
- marginBottom: undefined,
49
- marginLeft: undefined,
50
- marginRight: undefined,
51
34
  },
52
35
  ]}>
53
36
  {children}
@@ -5,6 +5,7 @@ import {GridContextProps, SectionProps} from './types';
5
5
  import {GridContext} from './index';
6
6
  import Item from './Item';
7
7
  import {ApplicationContext} from '../Application';
8
+ import styles from './styles';
8
9
 
9
10
  const Section: React.FC<SectionProps> = ({
10
11
  children,
@@ -38,20 +39,7 @@ const Section: React.FC<SectionProps> = ({
38
39
  * render overlay only dev mode
39
40
  */
40
41
  const renderOverlay = () => {
41
- return (
42
- <View
43
- pointerEvents={'none'}
44
- style={{
45
- position: 'absolute',
46
- top: 0,
47
- bottom: 0,
48
- left: 0,
49
- right: 0,
50
- borderColor: 'red',
51
- borderWidth: 1,
52
- }}
53
- />
54
- );
42
+ return <View pointerEvents={'none'} style={styles.boxGrid} />;
55
43
  };
56
44
 
57
45
  /**
@@ -0,0 +1,47 @@
1
+ import {StyleSheet} from 'react-native';
2
+
3
+ export default StyleSheet.create({
4
+ boxGrid: {
5
+ position: 'absolute',
6
+ top: 0,
7
+ bottom: 0,
8
+ left: 0,
9
+ right: 0,
10
+ borderColor: 'red',
11
+ borderWidth: 1,
12
+ },
13
+ card: {
14
+ flexDirection: 'row',
15
+ flexWrap: 'wrap',
16
+ paddingTop: undefined,
17
+ paddingBottom: undefined,
18
+ paddingLeft: undefined,
19
+ paddingRight: undefined,
20
+ paddingVertical: undefined,
21
+ paddingHorizontal: undefined,
22
+ padding: 12,
23
+ margin: undefined,
24
+ marginTop: undefined,
25
+ marginBottom: undefined,
26
+ marginLeft: undefined,
27
+ marginRight: undefined,
28
+ marginVertical: undefined,
29
+ },
30
+ item: {
31
+ overflow: 'hidden',
32
+ margin: undefined,
33
+ marginTop: undefined,
34
+ marginBottom: undefined,
35
+ marginLeft: undefined,
36
+ marginRight: undefined,
37
+ marginVertical: undefined,
38
+ marginHorizontal: undefined,
39
+ },
40
+ cardImage: {
41
+ position: 'absolute',
42
+ top: 0,
43
+ bottom: 0,
44
+ left: 0,
45
+ right: 0,
46
+ },
47
+ });
package/Layout/types.ts CHANGED
@@ -57,5 +57,5 @@ export interface ItemProps extends ViewProps {
57
57
  }
58
58
 
59
59
  export interface CardProps extends ViewProps {
60
- background?: string;
60
+ backgroundImage?: string;
61
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.77.3",
3
+ "version": "0.77.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {