@momo-kits/foundation 0.81.1 → 0.81.2

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.
@@ -441,7 +441,7 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
441
441
  <TouchableOpacity onPress={onPress}>
442
442
  <Animated.View
443
443
  style={{
444
- aspectRatio: 1.75,
444
+ height: 210,
445
445
  opacity: opacity,
446
446
  transform: [{scale}, {translateY}],
447
447
  }}>
@@ -152,6 +152,10 @@ const Spacing = {
152
152
  M: 12,
153
153
  L: 16,
154
154
  XL: 24,
155
+ XXL: 32,
156
+ Size48: 48,
157
+ Size56: 56,
158
+ Size64: 64,
155
159
  };
156
160
 
157
161
  const Radius = {
package/Layout/Card.tsx CHANGED
@@ -8,6 +8,7 @@ import {Image} from '../Image';
8
8
  import {ApplicationContext} from '../Application';
9
9
  import styles from './styles';
10
10
  import {Colors, Shadow, Spacing} from '../Consts';
11
+ import ItemList from './ItemList';
11
12
 
12
13
  export interface CardProps extends ViewProps {
13
14
  /**
@@ -15,6 +16,9 @@ export interface CardProps extends ViewProps {
15
16
  */
16
17
  backgroundImage?: string;
17
18
 
19
+ /**
20
+ * Optional. Use shadow for the card.
21
+ */
18
22
  useShadow?: boolean;
19
23
  }
20
24
 
@@ -155,7 +159,7 @@ const Card: React.FC<CardProps> = ({
155
159
  style={styles.imageBackground}
156
160
  />
157
161
  )}
158
- {renderView(validateChildren(children, [Item]))}
162
+ {renderView(validateChildren(children, [Item, ItemList]))}
159
163
  {showGrid && renderOverlay()}
160
164
  </View>
161
165
  </GridContext.Provider>
@@ -0,0 +1,63 @@
1
+ import React, {FC, ReactElement, useContext} from 'react';
2
+ import {FlatList, FlatListProps, View} from 'react-native';
3
+ import Item from './Item';
4
+ import {GridContext} from './index';
5
+
6
+ const ItemList: FC<FlatListProps<any>> = ({
7
+ renderItem,
8
+ numColumns = 1,
9
+ style,
10
+ ...props
11
+ }) => {
12
+ const {gutterSize} = useContext(GridContext);
13
+
14
+ const _renderItem = (info: any) => {
15
+ const {item, index, separators} = info;
16
+
17
+ const children = renderItem?.({
18
+ item,
19
+ index,
20
+ separators,
21
+ }) as ReactElement;
22
+
23
+ if (children?.type !== Item) {
24
+ console.warn('Wrong children type for this component, expected are Item');
25
+ }
26
+
27
+ const spacingStyle =
28
+ numColumns > 1
29
+ ? {
30
+ marginRight: gutterSize,
31
+ }
32
+ : {};
33
+
34
+ return <View style={spacingStyle}>{children}</View>;
35
+ };
36
+
37
+ return (
38
+ <FlatList
39
+ {...props}
40
+ numColumns={numColumns}
41
+ renderItem={_renderItem}
42
+ horizontal={false}
43
+ ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
44
+ style={[
45
+ style,
46
+ {
47
+ marginTop: undefined,
48
+ marginBottom: undefined,
49
+ marginLeft: undefined,
50
+ marginRight: undefined,
51
+ paddingTop: undefined,
52
+ paddingBottom: undefined,
53
+ paddingLeft: undefined,
54
+ paddingRight: undefined,
55
+ padding: undefined,
56
+ margin: undefined,
57
+ },
58
+ ]}
59
+ />
60
+ );
61
+ };
62
+
63
+ export default ItemList;
@@ -7,6 +7,7 @@ import Item from './Item';
7
7
  import {ApplicationContext} from '../Application';
8
8
  import styles from './styles';
9
9
  import {Image} from '../Image';
10
+ import ItemList from './ItemList';
10
11
 
11
12
  export interface SectionProps extends ViewProps {
12
13
  /**
@@ -168,7 +169,7 @@ const Section: React.FC<SectionProps> = ({
168
169
  style={styles.imageBackground}
169
170
  />
170
171
  )}
171
- {renderView(validateChildren(children, [Item]))}
172
+ {renderView(validateChildren(children, [Item, ItemList]))}
172
173
  {showGrid && renderOverlay()}
173
174
  </View>
174
175
  </GridContext.Provider>
package/Layout/index.ts CHANGED
@@ -5,6 +5,7 @@ import {validateChildren} from './utils';
5
5
  import {createContext} from 'react';
6
6
  import {GridContextProps} from './types';
7
7
  import Item from './Item';
8
+ import ItemList from './ItemList';
8
9
 
9
10
  const GridContext = createContext<GridContextProps>({
10
11
  numberOfColumns: 12,
@@ -14,4 +15,12 @@ const GridContext = createContext<GridContextProps>({
14
15
  getSizeSpan: () => 0,
15
16
  });
16
17
 
17
- export {GridContext, Card, Section, GridSystem, validateChildren, Item};
18
+ export {
19
+ GridContext,
20
+ Card,
21
+ Section,
22
+ GridSystem,
23
+ validateChildren,
24
+ Item,
25
+ ItemList,
26
+ };
package/Layout/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import {FlatListProps} from 'react-native';
2
+
1
3
  export type GridContextProps = {
2
4
  /**
3
5
  * Represents the number of columns in the grid.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.1",
3
+ "version": "0.81.2",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {