@momo-kits/foundation 0.81.2 → 0.81.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.
@@ -2,11 +2,13 @@ import React, {FC, ReactElement, useContext} from 'react';
2
2
  import {FlatList, FlatListProps, View} from 'react-native';
3
3
  import Item from './Item';
4
4
  import {GridContext} from './index';
5
+ import styles from './styles';
5
6
 
6
7
  const ItemList: FC<FlatListProps<any>> = ({
7
8
  renderItem,
8
9
  numColumns = 1,
9
10
  style,
11
+ contentContainerStyle,
10
12
  ...props
11
13
  }) => {
12
14
  const {gutterSize} = useContext(GridContext);
@@ -24,14 +26,16 @@ const ItemList: FC<FlatListProps<any>> = ({
24
26
  console.warn('Wrong children type for this component, expected are Item');
25
27
  }
26
28
 
27
- const spacingStyle =
28
- numColumns > 1
29
- ? {
29
+ return (
30
+ <View
31
+ style={
32
+ numColumns > 1 && {
30
33
  marginRight: gutterSize,
31
34
  }
32
- : {};
33
-
34
- return <View style={spacingStyle}>{children}</View>;
35
+ }>
36
+ {children}
37
+ </View>
38
+ );
35
39
  };
36
40
 
37
41
  return (
@@ -41,21 +45,8 @@ const ItemList: FC<FlatListProps<any>> = ({
41
45
  renderItem={_renderItem}
42
46
  horizontal={false}
43
47
  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
- ]}
48
+ style={[style, styles.protectedStyle]}
49
+ contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
59
50
  />
60
51
  );
61
52
  };
package/Layout/styles.ts CHANGED
@@ -77,4 +77,20 @@ export default StyleSheet.create({
77
77
  right: 0,
78
78
  borderRadius: Spacing.M,
79
79
  },
80
+ protectedStyle: {
81
+ marginTop: undefined,
82
+ marginBottom: undefined,
83
+ marginLeft: undefined,
84
+ marginRight: undefined,
85
+ paddingTop: undefined,
86
+ paddingBottom: undefined,
87
+ paddingLeft: undefined,
88
+ paddingRight: undefined,
89
+ padding: undefined,
90
+ margin: undefined,
91
+ marginHorizontal: undefined,
92
+ marginVertical: undefined,
93
+ paddingHorizontal: undefined,
94
+ paddingVertical: undefined,
95
+ },
80
96
  });
package/Layout/types.ts CHANGED
@@ -1,5 +1,3 @@
1
- import {FlatListProps} from 'react-native';
2
-
3
1
  export type GridContextProps = {
4
2
  /**
5
3
  * Represents the number of columns in the grid.
package/Layout/utils.ts CHANGED
@@ -8,7 +8,7 @@ import React, {Fragment, ReactElement, useEffect, useState} from 'react';
8
8
  */
9
9
  const validateChildren = (
10
10
  children: React.ReactNode | React.ReactNode[],
11
- childrenTypes: Array<React.FC>,
11
+ childrenTypes: Array<React.ReactNode>,
12
12
  ) => {
13
13
  const validateType = (child: React.ReactElement) => {
14
14
  const valid = childrenTypes.some(
@@ -17,7 +17,7 @@ const validateChildren = (
17
17
  if (!valid) {
18
18
  console.warn(
19
19
  `Wrong children type for this component, expected are ${childrenTypes
20
- .map(type => type.displayName)
20
+ .map(item => item)
21
21
  .join(', ')}.`,
22
22
  );
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.2",
3
+ "version": "0.81.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {