@momo-kits/foundation 0.81.1-beta.2 → 0.81.1-beta.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.
@@ -160,7 +160,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
160
160
  navigator?.pop();
161
161
  }
162
162
  }}
163
- bottomInset={bottomInset}
163
+ bottomInset={Platform.OS === 'ios' ? bottomInset : 0}
164
164
  handleComponent={null}
165
165
  backdropComponent={backdropComponent}>
166
166
  <BottomSheetView accessibilityLabel={'BottomSheet'}>
@@ -125,9 +125,7 @@ export interface NavigationOptions extends StackNavigationOptions {
125
125
  onPressLeftHeader?: () => void;
126
126
  surface?: boolean;
127
127
  hiddenBack?: boolean;
128
- headerTitleAlign?: 'left' | 'center';
129
128
  customTitle?: TitleCustomProps;
130
- animatedValue?: Animated.Value;
131
129
  }
132
130
 
133
131
  export interface HeaderBackProps extends NavigationButtonProps {
@@ -103,7 +103,7 @@ const InputOTP: FC<InputOTPProps> = ({
103
103
  };
104
104
 
105
105
  const renderInputs = (length: number) => {
106
- const TextInputs = [];
106
+ const TextInputs: React.ReactNode[] = [];
107
107
  for (let i = 0; i < length; i++) {
108
108
  TextInputs.push(
109
109
  <View>
package/Layout/Item.tsx CHANGED
@@ -5,7 +5,7 @@ import {GridContext} from './index';
5
5
  import {ApplicationContext} from '../Application';
6
6
  import styles from './styles';
7
7
 
8
- type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
8
+ export type SpanNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
9
9
 
10
10
  export interface ItemProps extends ViewProps {
11
11
  /**
@@ -1,39 +1,40 @@
1
- import React, {FC, ReactElement, useContext} from 'react';
1
+ import React, {FC, useContext} from 'react';
2
2
  import {FlatList, FlatListProps, View} from 'react-native';
3
- import Item from './Item';
3
+ import Item, {SpanNumber} from './Item';
4
4
  import {GridContext} from './index';
5
5
  import styles from './styles';
6
6
 
7
- const ItemList: FC<FlatListProps<any>> = ({
7
+ export interface ItemListProps extends FlatListProps<any> {
8
+ /**
9
+ * Require key support number columns change grid system
10
+ */
11
+
12
+ key: string;
13
+ /**
14
+ * Represents the width of the Card component in terms of span numbers (1-12).
15
+ */
16
+ widthSpan?: SpanNumber;
17
+ }
18
+
19
+ const ItemList: FC<ItemListProps> = ({
20
+ key,
8
21
  renderItem,
9
- numColumns = 1,
22
+ widthSpan,
10
23
  style,
11
24
  contentContainerStyle,
12
25
  ...props
13
26
  }) => {
14
- const {gutterSize} = useContext(GridContext);
15
-
16
- const _renderItem = (info: any) => {
17
- const {item, index, separators} = info;
18
-
19
- const children = renderItem?.({
20
- item,
21
- index,
22
- separators,
23
- }) as ReactElement;
24
-
25
- if (children?.type !== Item) {
26
- console.warn('Wrong children type for this component, expected are Item');
27
+ const {gutterSize, numberOfColumns} = useContext(GridContext);
28
+ const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
29
+ const numColumns = Math.floor(numberOfColumns / widthItem);
30
+ const indexBegin = props?.data?.map((_i, index) => index * numColumns);
31
+ const _renderItem = (item: any) => {
32
+ if (indexBegin?.includes(item?.index)) {
33
+ return <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>;
27
34
  }
28
-
29
35
  return (
30
- <View
31
- style={
32
- numColumns > 1 && {
33
- marginRight: gutterSize,
34
- }
35
- }>
36
- {children}
36
+ <View style={{paddingLeft: gutterSize}}>
37
+ <Item widthSpan={widthItem}>{renderItem?.(item)}</Item>
37
38
  </View>
38
39
  );
39
40
  };
@@ -41,6 +42,7 @@ const ItemList: FC<FlatListProps<any>> = ({
41
42
  return (
42
43
  <FlatList
43
44
  {...props}
45
+ key={`${key ?? 'ItemList'}${numColumns}}`}
44
46
  numColumns={numColumns}
45
47
  renderItem={_renderItem}
46
48
  horizontal={false}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.1-beta.2",
3
+ "version": "0.81.1-beta.4",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {