@momo-kits/foundation 0.81.5 → 0.81.6

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,13 +2,11 @@ import React, {Fragment, useContext, useEffect, useState} from 'react';
2
2
  import {
3
3
  Animated,
4
4
  DeviceEventEmitter,
5
- Platform,
6
5
  StatusBar,
7
6
  StyleSheet,
8
7
  TouchableOpacity,
9
8
  View,
10
9
  } from 'react-native';
11
- import {TouchableOpacity as TouchableGesture} from 'react-native-gesture-handler';
12
10
  import {ApplicationContext} from './index';
13
11
  import {Colors, Radius, Spacing, Styles} from '../Consts';
14
12
  import {Image} from '../Image';
@@ -24,9 +22,6 @@ import {scaleSize, Text} from '../Text';
24
22
  import {Icon} from '../Icon';
25
23
  import {PopupNotify} from '../Popup';
26
24
 
27
- const Touchable =
28
- Platform.OS === 'android' ? TouchableGesture : TouchableOpacity;
29
-
30
25
  const styles = StyleSheet.create({
31
26
  navigationButton: {
32
27
  height: 28,
@@ -106,7 +101,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
106
101
  }
107
102
 
108
103
  return (
109
- <Touchable
104
+ <TouchableOpacity
110
105
  accessibilityLabel={`NavigationButton/${accessibilityLabel}`}
111
106
  style={[
112
107
  styles.navigationButton,
@@ -121,7 +116,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
121
116
  color={tintColor ?? theme.colors.text.default}
122
117
  size={20}
123
118
  />
124
- </Touchable>
119
+ </TouchableOpacity>
125
120
  );
126
121
  };
127
122
 
@@ -397,17 +392,21 @@ const HeaderToolkitAction: React.FC<any> = ({tintColor}) => {
397
392
  borderWidth: backgroundColor ? 0.5 : 0,
398
393
  },
399
394
  ]}>
400
- <Touchable accessibilityLabel={'Toolkit/More'} onPress={onMore}>
395
+ <TouchableOpacity
396
+ accessibilityLabel={'Toolkit/More'}
397
+ onPress={onMore}>
401
398
  <Icon color={tintColor} source="navigation_more_horiz" size={20} />
402
- </Touchable>
399
+ </TouchableOpacity>
403
400
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
404
- <Touchable accessibilityLabel={`Toolkit/Close`} onPress={onClose}>
401
+ <TouchableOpacity
402
+ accessibilityLabel={`Toolkit/Close`}
403
+ onPress={onClose}>
405
404
  <Icon
406
405
  color={tintColor}
407
406
  source="16_navigation_close_circle"
408
407
  size={20}
409
408
  />
410
- </Touchable>
409
+ </TouchableOpacity>
411
410
  </View>
412
411
  </View>
413
412
  );
@@ -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.5",
3
+ "version": "0.81.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  "@momo-kits/foundation"
11
11
  ],
12
12
  "dependencies": {
13
- "@gorhom/bottom-sheet": "2.4.1",
13
+ "@gorhom/bottom-sheet": "git+https://gitlab.com/dung.huynh1/bottom-sheet.git#main",
14
14
  "react-native-safe-area-context": "3.1.4",
15
15
  "react-native-linear-gradient": "2.5.6",
16
16
  "react-native-gesture-handler": "1.10.3",
package/tsconfig.json CHANGED
@@ -20,6 +20,5 @@
20
20
  "skipLibCheck": true,
21
21
  "strict": true,
22
22
  "target": "esnext",
23
- "verbatimModuleSyntax": false
24
23
  }
25
24
  }