@momo-kits/foundation 0.156.1-beta.9 → 0.156.1-test.20

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.
Files changed (51) hide show
  1. package/Application/BottomTab/BottomTabBar.tsx +2 -1
  2. package/Application/BottomTab/CustomBottomTabItem.tsx +2 -2
  3. package/Application/BottomTab/index.tsx +1 -1
  4. package/Application/ModalScreen.tsx +46 -33
  5. package/Badge/Badge.tsx +2 -0
  6. package/Badge/BadgeDot.tsx +2 -0
  7. package/Badge/BadgeDotAnimation.tsx +2 -0
  8. package/Badge/BadgeRibbon.tsx +2 -0
  9. package/Button/index.tsx +2 -0
  10. package/CheckBox/index.tsx +2 -0
  11. package/Context/index.ts +10 -0
  12. package/Divider/DashDivider.tsx +2 -0
  13. package/Divider/index.tsx +3 -1
  14. package/Icon/index.tsx +2 -0
  15. package/IconButton/index.tsx +2 -0
  16. package/Image/index.tsx +2 -0
  17. package/Input/Input.tsx +2 -0
  18. package/Input/InputDropDown.tsx +2 -0
  19. package/Input/InputMoney.tsx +2 -0
  20. package/Input/InputOTP.tsx +2 -0
  21. package/Input/InputPhoneNumber.tsx +2 -0
  22. package/Input/InputSearch.tsx +5 -1
  23. package/Input/InputTextArea.tsx +2 -0
  24. package/Layout/Card.tsx +2 -1
  25. package/Layout/FloatingButton.tsx +2 -0
  26. package/Layout/Item.tsx +2 -0
  27. package/Layout/ItemList.tsx +2 -0
  28. package/Layout/ItemSectionList.tsx +2 -0
  29. package/Layout/Screen.tsx +681 -68
  30. package/Layout/Section.tsx +2 -1
  31. package/Layout/TrackingScope.tsx +2 -0
  32. package/Layout/index.ts +2 -1
  33. package/Layout/utils.ts +15 -2
  34. package/Loader/DotLoader.tsx +2 -0
  35. package/Loader/Loader.tsx +3 -1
  36. package/Loader/ProgressBar.tsx +2 -0
  37. package/Loader/Spinner.tsx +2 -0
  38. package/Pagination/Dot.tsx +2 -0
  39. package/Pagination/PaginationDot.tsx +2 -0
  40. package/Pagination/PaginationNumber.tsx +2 -0
  41. package/Pagination/PaginationScroll.tsx +2 -0
  42. package/Pagination/PaginationWhiteDot.tsx +2 -0
  43. package/Popup/PopupNotify.tsx +4 -33
  44. package/Popup/PopupPromotion.tsx +4 -31
  45. package/Radio/index.tsx +2 -1
  46. package/Skeleton/index.tsx +2 -0
  47. package/Switch/index.tsx +2 -0
  48. package/Tag/index.tsx +2 -0
  49. package/Text/index.tsx +2 -0
  50. package/internal.ts +2 -0
  51. package/package.json +34 -34
@@ -298,7 +298,8 @@ const styles = StyleSheet.create({
298
298
  alignItems: 'center',
299
299
  left: 0,
300
300
  right: 0,
301
- bottom: Platform.OS === 'ios' ? -6 : 4,
301
+ top: -2,
302
+ bottom: Platform.OS === 'ios' ? -6 : 4
302
303
  },
303
304
  floatingContent: {
304
305
  alignItems: 'center',
@@ -1,5 +1,5 @@
1
1
  import React, { useContext } from 'react';
2
- import { TouchableOpacity, StyleSheet, Platform } from 'react-native';
2
+ import { TouchableOpacity, StyleSheet } from 'react-native';
3
3
  import {
4
4
  BottomTabBarButtonProps,
5
5
  BottomTabNavigationOptions,
@@ -143,7 +143,7 @@ const styles = StyleSheet.create({
143
143
  alignItems: 'center',
144
144
  justifyContent: 'center',
145
145
  paddingVertical: 8,
146
- bottom: Platform.OS === 'ios' ? 8 : -2,
146
+ bottom: -2,
147
147
  },
148
148
  label: {
149
149
  fontSize: 12,
@@ -389,7 +389,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
389
389
  title: item.label,
390
390
  tabBarStyle: [
391
391
  {
392
- height: 64 + Math.min(insets.bottom, 21),
392
+ height: 64,
393
393
  },
394
394
  styles.tabStyle,
395
395
  ],
@@ -19,18 +19,6 @@ import BottomSheet from './BottomSheet';
19
19
  import { runOnJS } from 'react-native-reanimated';
20
20
 
21
21
  const ModalScreen: React.FC<any> = props => {
22
- const context: any = useContext(MiniAppContext);
23
- const { navigator } = useContext(ApplicationContext);
24
-
25
- useEffect(
26
- () => {
27
- if (context?.enableHapticDialog) {
28
- navigator?.maxApi?.triggerEventVibration?.('light');
29
- }
30
- }, // eslint-disable-next-line react-hooks/exhaustive-deps
31
- [],
32
- );
33
-
34
22
  if (props.route?.params?.isBottomSheet) {
35
23
  return <BottomSheet {...props} />;
36
24
  }
@@ -39,6 +27,8 @@ const ModalScreen: React.FC<any> = props => {
39
27
 
40
28
  const Modal: React.FC<ModalParams> = props => {
41
29
  const { navigator } = useContext(ApplicationContext);
30
+ const context = useContext<any>(MiniAppContext);
31
+ const modalParams = useRef<any>(undefined);
42
32
  const {
43
33
  screen,
44
34
  barrierDismissible,
@@ -60,6 +50,26 @@ const Modal: React.FC<ModalParams> = props => {
60
50
  Container = ModalRN;
61
51
  }
62
52
 
53
+ if (screen != null) {
54
+ const screenProps = screen?.()?.props || {};
55
+ modalParams.current = {
56
+ title: screenProps?.title || '',
57
+ description: screenProps?.description || '',
58
+ };
59
+ }
60
+
61
+ useEffect(() => {
62
+ const item: any = {
63
+ screenName: params.screen,
64
+ componentName: 'Modal',
65
+ ...modalParams.current,
66
+ };
67
+ context?.autoTracking?.({
68
+ ...context,
69
+ ...item,
70
+ });
71
+ }, [context, params.screen]);
72
+
63
73
  useEffect(() => {
64
74
  Animated.parallel([
65
75
  Animated.timing(opacity, {
@@ -80,27 +90,30 @@ const Modal: React.FC<ModalParams> = props => {
80
90
  };
81
91
  }, [opacity, props.route.params, scale]);
82
92
 
83
- const onDismiss = useCallback((callback = () => {}, preventClose = false) => {
84
- if (preventClose) {
85
- return;
86
- }
87
- Animated.parallel([
88
- Animated.timing(opacity, {
89
- toValue: 0,
90
- duration: 200,
91
- useNativeDriver: true,
92
- }),
93
- Animated.timing(scale, {
94
- toValue: 0.8,
95
- duration: 200,
96
- easing: Easing.linear,
97
- useNativeDriver: true,
98
- }),
99
- ]).start(() => {
100
- navigator?.pop();
101
- runOnJS(callback)();
102
- });
103
- }, [navigator, opacity, scale]);
93
+ const onDismiss = useCallback(
94
+ (callback = () => {}, preventClose = false) => {
95
+ if (preventClose) {
96
+ return;
97
+ }
98
+ Animated.parallel([
99
+ Animated.timing(opacity, {
100
+ toValue: 0,
101
+ duration: 200,
102
+ useNativeDriver: true,
103
+ }),
104
+ Animated.timing(scale, {
105
+ toValue: 0.8,
106
+ duration: 200,
107
+ easing: Easing.linear,
108
+ useNativeDriver: true,
109
+ }),
110
+ ]).start(() => {
111
+ navigator?.pop();
112
+ runOnJS(callback)();
113
+ });
114
+ },
115
+ [navigator, opacity, scale],
116
+ );
104
117
 
105
118
  useEffect(() => {
106
119
  const backHandler = BackHandler.addEventListener(
package/Badge/Badge.tsx CHANGED
@@ -6,6 +6,7 @@ import { ApplicationContext, MiniAppContext } from '../Context';
6
6
  import { BadgeProps } from './types';
7
7
  import { Colors, Radius, Spacing } from '../Consts';
8
8
  import { Text, useScaleSize } from '../Text';
9
+ import { useScreenRegistry } from '../Layout/utils';
9
10
 
10
11
  const Badge: FC<BadgeProps> = ({
11
12
  label = '',
@@ -13,6 +14,7 @@ const Badge: FC<BadgeProps> = ({
13
14
  backgroundColor,
14
15
  accessibilityLabel,
15
16
  }) => {
17
+ useScreenRegistry('Badge');
16
18
  const { theme } = useContext(ApplicationContext);
17
19
  const context = useContext<any>(MiniAppContext);
18
20
  const { componentId } = useComponentId('Badge', accessibilityLabel);
@@ -3,8 +3,10 @@ import { View } from 'react-native';
3
3
  import { BadgeDotProps } from './types';
4
4
  import styles from './styles';
5
5
  import { MiniAppContext } from '../Context';
6
+ import { useScreenRegistry } from '../Layout/utils';
6
7
 
7
8
  const BadgeDot: FC<BadgeDotProps> = ({ size = 'large', style }) => {
9
+ useScreenRegistry('BadgeDot');
8
10
  const context = useContext<any>(MiniAppContext);
9
11
  let dotStyle;
10
12
  let dotContainerStyle;
@@ -2,10 +2,12 @@ import React, { useEffect, useRef } from 'react';
2
2
  import { Animated, View } from 'react-native';
3
3
  import { BadgeDotProps } from './types';
4
4
  import styles from './styles';
5
+ import { useScreenRegistry } from '../Layout/utils';
5
6
 
6
7
  const DURATION = 500;
7
8
 
8
9
  const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
10
+ useScreenRegistry('BadgeDotAnimation');
9
11
  // Refs for animated values
10
12
  const scaleAnim = useRef(new Animated.Value(1)).current;
11
13
  const waveScaleAnim = useRef(new Animated.Value(1)).current;
@@ -7,6 +7,7 @@ import { ApplicationContext, MiniAppContext } from '../Context';
7
7
  import { Text } from '../Text';
8
8
  import { Colors } from '../Consts';
9
9
  import { Image } from '../Image';
10
+ import { useScreenRegistry } from '../Layout/utils';
10
11
 
11
12
  const BadgeRibbon: FC<BadgeRibbonProps> = ({
12
13
  position = 'top_right',
@@ -14,6 +15,7 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
14
15
  isRound = false,
15
16
  style = {},
16
17
  }) => {
18
+ useScreenRegistry('BadgeRibbon');
17
19
  const { theme } = useContext(ApplicationContext);
18
20
  const context = useContext<any>(MiniAppContext);
19
21
  const isRight = position === 'top_right' || position === 'bottom_right';
package/Button/index.tsx CHANGED
@@ -28,6 +28,7 @@ import Reanimated, {
28
28
  useSharedValue,
29
29
  withTiming,
30
30
  } from 'react-native-reanimated';
31
+ import { useScreenRegistry } from '../Layout';
31
32
 
32
33
  const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
33
34
 
@@ -73,6 +74,7 @@ const Button: FC<ButtonProps> = ({
73
74
  }) => {
74
75
  const { theme, config } = useContext(ApplicationContext);
75
76
  const context = useContext<any>(MiniAppContext);
77
+ useScreenRegistry('Button');
76
78
  const skeleton = useContext(SkeletonContext);
77
79
  const animationRef = useRef<LottieView>(null);
78
80
  const pressAnim = useSharedValue(0);
@@ -10,6 +10,7 @@ import {
10
10
  } from '../Context';
11
11
  import { Text } from '../Text';
12
12
  import { Icon } from '../Icon';
13
+ import { useScreenRegistry } from '../Layout';
13
14
 
14
15
  const CheckBox: FC<CheckBoxProps> = ({
15
16
  value,
@@ -24,6 +25,7 @@ const CheckBox: FC<CheckBoxProps> = ({
24
25
  }) => {
25
26
  const { theme } = useContext(ApplicationContext);
26
27
  const context = useContext<any>(MiniAppContext);
28
+ useScreenRegistry('CheckBox');
27
29
  const haveValue = value || indeterminate;
28
30
  const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
29
31
  let borderColor = theme.colors.text.default;
package/Context/index.ts CHANGED
@@ -2,8 +2,17 @@ import { Platform } from 'react-native';
2
2
  import { createContext } from 'react';
3
3
  import { defaultContext } from '../Consts';
4
4
 
5
+ export type ScreenRegistryContextType = {
6
+ register: (id: string, name: string) => void;
7
+ unregister: (id: string) => void;
8
+ };
9
+
5
10
  const Context = createContext({});
6
11
  const ApplicationContext = createContext(defaultContext);
12
+ const ScreenRegistryContext = createContext<ScreenRegistryContextType>({
13
+ register: () => {},
14
+ unregister: () => {},
15
+ });
7
16
 
8
17
  const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
9
18
  const ScreenContext = (Platform as any).ScreenContext ?? Context;
@@ -20,6 +29,7 @@ export {
20
29
  ApplicationContext,
21
30
  MiniAppContext,
22
31
  ScreenContext,
32
+ ScreenRegistryContext,
23
33
  ComponentContext,
24
34
  SkeletonContext,
25
35
  TrackingScopeContext,
@@ -3,6 +3,7 @@ import { View, ViewStyle } from 'react-native';
3
3
  import { ApplicationContext } from '../Context';
4
4
  import { Spacing } from '../Consts';
5
5
  import Svg, { Line } from 'react-native-svg';
6
+ import { useScreenRegistry } from '../Layout/utils';
6
7
 
7
8
  export interface DashDividerProps {
8
9
  /**
@@ -12,6 +13,7 @@ export interface DashDividerProps {
12
13
  }
13
14
 
14
15
  const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
16
+ useScreenRegistry('DashDivider');
15
17
  const { theme } = useContext(ApplicationContext);
16
18
  const borderColor = theme.colors.border.default;
17
19
 
package/Divider/index.tsx CHANGED
@@ -3,6 +3,7 @@ import { View, ViewStyle } from 'react-native';
3
3
  import { ApplicationContext } from '../Context';
4
4
  import { Spacing } from '../Consts';
5
5
  import { DashDivider } from './DashDivider';
6
+ import { useScreenRegistry } from '../Layout';
6
7
 
7
8
  export interface DividerProps {
8
9
  /**
@@ -25,8 +26,9 @@ const Divider: React.FC<DividerProps> = ({
25
26
  }) => {
26
27
  const { theme } = useContext(ApplicationContext);
27
28
 
28
- if (type === 'dash') return <DashDivider style={style} />;
29
+ useScreenRegistry('Divider');
29
30
 
31
+ if (type === 'dash') return <DashDivider style={style} />;
30
32
  return (
31
33
  <View
32
34
  style={[
package/Icon/index.tsx CHANGED
@@ -6,6 +6,7 @@ import { ApplicationContext, MiniAppContext } from '../Context';
6
6
  import { Image } from '../Image';
7
7
  import { StyleSheet } from 'react-native';
8
8
  import { Colors } from '../Consts';
9
+ import { useScreenRegistry } from '../Layout';
9
10
 
10
11
  const Icon: React.FC<IconProps> = ({
11
12
  source = 'ic_back',
@@ -16,6 +17,7 @@ const Icon: React.FC<IconProps> = ({
16
17
  }) => {
17
18
  const { theme } = useContext(ApplicationContext);
18
19
  const context = useContext<any>(MiniAppContext);
20
+ useScreenRegistry('Icon');
19
21
 
20
22
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
21
23
 
@@ -12,6 +12,7 @@ import {
12
12
  import { Colors } from '../Consts';
13
13
  import { Icon } from '../Icon';
14
14
  import styles from './styles';
15
+ import { useScreenRegistry } from '../Layout';
15
16
 
16
17
  export interface IconButtonProps extends TouchableOpacityProps {
17
18
  /**
@@ -43,6 +44,7 @@ const IconButton: React.FC<IconButtonProps> = ({
43
44
  params,
44
45
  ...rest
45
46
  }) => {
47
+ useScreenRegistry('IconButton');
46
48
  const { theme } = useContext(ApplicationContext);
47
49
  const context = useContext<any>(MiniAppContext);
48
50
 
package/Image/index.tsx CHANGED
@@ -12,6 +12,7 @@ import { Skeleton } from '../Skeleton';
12
12
  import { Icon } from '../Icon';
13
13
  import { Styles } from '../Consts';
14
14
  import { ImageProps } from './types';
15
+ import { useScreenRegistry } from '../Layout';
15
16
 
16
17
  type Status = 'success' | 'loading' | 'error';
17
18
 
@@ -36,6 +37,7 @@ const Image: React.FC<ImageProps> = ({
36
37
  const skeleton = useContext(SkeletonContext);
37
38
  const error = useRef(false);
38
39
  const [status, setStatus] = useState<Status>('success');
40
+ useScreenRegistry('Image');
39
41
 
40
42
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
41
43
 
package/Input/Input.tsx CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  ComponentContext,
32
32
  MiniAppContext,
33
33
  } from '../Context';
34
+ import { useScreenRegistry } from '../Layout/utils';
34
35
 
35
36
  /**
36
37
  * Input default component
@@ -72,6 +73,7 @@ const Input = forwardRef(
72
73
  }: InputProps,
73
74
  ref,
74
75
  ) => {
76
+ useScreenRegistry('Input');
75
77
  const { theme } = useContext(ApplicationContext);
76
78
  const context = useContext<any>(MiniAppContext);
77
79
  const scaledFontSize = useScaleSize(14);
@@ -17,6 +17,7 @@ import { InputDropDownProps } from './index';
17
17
  import { Text, useScaleSize } from '../Text';
18
18
  import styles from './styles';
19
19
  import { Spacing } from '../Consts';
20
+ import { useScreenRegistry } from '../Layout/utils';
20
21
 
21
22
  const InputDropDown = ({
22
23
  value,
@@ -38,6 +39,7 @@ const InputDropDown = ({
38
39
  multiline,
39
40
  ...props
40
41
  }: InputDropDownProps) => {
42
+ useScreenRegistry('InputDropDown');
41
43
  const { theme } = useContext(ApplicationContext);
42
44
  const context = useContext<any>(MiniAppContext);
43
45
  const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
@@ -34,6 +34,7 @@ import { InputMoneyProps } from './index';
34
34
  import styles from './styles';
35
35
  import { formatNumberToMoney } from './utils';
36
36
  import SystemTextInput from './SystemTextInput';
37
+ import { useScreenRegistry } from '../Layout/utils';
37
38
 
38
39
  const InputMoney = forwardRef(
39
40
  (
@@ -65,6 +66,7 @@ const InputMoney = forwardRef(
65
66
  }: InputMoneyProps,
66
67
  ref,
67
68
  ) => {
69
+ useScreenRegistry('InputMoney');
68
70
  const { theme } = useContext(ApplicationContext);
69
71
  const context = useContext<any>(MiniAppContext);
70
72
  const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
@@ -28,6 +28,7 @@ import {
28
28
  ComponentContext,
29
29
  MiniAppContext,
30
30
  } from '../Context';
31
+ import { useScreenRegistry } from '../Layout/utils';
31
32
 
32
33
  const OTPCaret: FC<CaretProps> = ({ index, length }) => {
33
34
  const DURATION = 300;
@@ -90,6 +91,7 @@ const InputOTP = forwardRef(
90
91
  }: InputOTPProps,
91
92
  ref,
92
93
  ) => {
94
+ useScreenRegistry('InputOTP');
93
95
  const MAX_LENGTH = 10;
94
96
  const [value, setValue] = useState('');
95
97
  const [focused, setFocused] = useState(false);
@@ -33,6 +33,7 @@ import styles from './styles';
33
33
  import SystemTextInput from './SystemTextInput';
34
34
  import { Image } from '../Image';
35
35
  import { Typography } from '../Text/types';
36
+ import { useScreenRegistry } from '../Layout/utils';
36
37
 
37
38
  /**
38
39
  * Input default component
@@ -65,6 +66,7 @@ const InputPhoneNumber = forwardRef(
65
66
  }: InputPhoneNumberProps,
66
67
  ref,
67
68
  ) => {
69
+ useScreenRegistry('InputPhoneNumber');
68
70
  const { theme } = useContext(ApplicationContext);
69
71
  const context = useContext<any>(MiniAppContext);
70
72
  const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
@@ -28,6 +28,7 @@ import { InputRef, InputSearchProps } from './index';
28
28
  import styles from './styles';
29
29
  import { Styles } from '../Consts';
30
30
  import SystemTextInput from './SystemTextInput';
31
+ import { useScreenRegistry } from '../Layout/utils';
31
32
 
32
33
  const TextTyping: FC<any> = ({
33
34
  data = [],
@@ -141,6 +142,7 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
141
142
  },
142
143
  ref,
143
144
  ) => {
145
+ useScreenRegistry('InputSearch');
144
146
  const { theme } = useContext(ApplicationContext);
145
147
  const context = useContext<any>(MiniAppContext);
146
148
  const scaledFontSize = useScaleSize(14);
@@ -348,4 +350,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
348
350
  );
349
351
  };
350
352
 
351
- export default forwardRef(InputSearch);
353
+ const ForwardedInputSearch = forwardRef(InputSearch);
354
+ ForwardedInputSearch.displayName = 'InputSearch';
355
+ export default ForwardedInputSearch;
@@ -22,6 +22,7 @@ import { InputTextAreaProps } from './index';
22
22
  import styles from './styles';
23
23
  import SystemTextInput from './SystemTextInput';
24
24
  import { useComponentId } from '../Application';
25
+ import { useScreenRegistry } from '../Layout/utils';
25
26
 
26
27
  const InputTextArea = forwardRef(
27
28
  (
@@ -47,6 +48,7 @@ const InputTextArea = forwardRef(
47
48
  }: InputTextAreaProps,
48
49
  ref,
49
50
  ) => {
51
+ useScreenRegistry('InputTextArea');
50
52
  const componentName = 'InputTextArea';
51
53
 
52
54
  const { componentId } = useComponentId(
package/Layout/Card.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { Dimensions, View, ViewProps } from 'react-native';
3
- import { useGridSystem } from './utils';
3
+ import { useGridSystem, useScreenRegistry } from './utils';
4
4
  import { GridContextProps } from './types';
5
5
  import { GridContext, GridSystem } from './index';
6
6
  import { Image } from '../Image';
@@ -27,6 +27,7 @@ const Card: React.FC<CardProps> = ({
27
27
  useShadow = false,
28
28
  ...props
29
29
  }) => {
30
+ useScreenRegistry('Card');
30
31
  const { showGrid, theme } = useContext(ApplicationContext);
31
32
  const { numberOfColumns } = useGridSystem();
32
33
 
@@ -14,6 +14,7 @@ import {
14
14
  } from 'react-native';
15
15
  import { ApplicationContext } from '../Context';
16
16
  import { Icon } from '../Icon';
17
+ import { useScreenRegistry } from './utils';
17
18
 
18
19
  export interface FloatingButtonProps {
19
20
  label?: string;
@@ -38,6 +39,7 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
38
39
  animatedValue,
39
40
  bottom = 12,
40
41
  }: FloatingButtonProps) => {
42
+ useScreenRegistry('FloatingButton');
41
43
  const { theme } = useContext(ApplicationContext);
42
44
  const maxWidth = useRef(0);
43
45
  const minWidth = size === 'small' ? 36 : 48;
package/Layout/Item.tsx CHANGED
@@ -2,6 +2,7 @@ import React, { useContext } from 'react';
2
2
  import { View, ViewProps } from 'react-native';
3
3
  import { GridContext } from './index';
4
4
  import { ApplicationContext, MiniAppContext } from '../Context';
5
+ import { useScreenRegistry } from './utils';
5
6
  import styles from './styles';
6
7
  import { SpanNumber } from './types';
7
8
 
@@ -23,6 +24,7 @@ const Item: React.FC<ItemProps> = ({
23
24
  children,
24
25
  style,
25
26
  }) => {
27
+ useScreenRegistry('Item');
26
28
  const { showGrid } = useContext(ApplicationContext);
27
29
  const context = useContext<any>(MiniAppContext);
28
30
  const grid = useContext(GridContext);
@@ -4,6 +4,7 @@ import Item from './Item';
4
4
  import { GridContext } from './index';
5
5
  import styles from './styles';
6
6
  import { SpanNumber } from './types';
7
+ import { useScreenRegistry } from './utils';
7
8
 
8
9
  export interface ItemListProps extends FlatListProps<any> {
9
10
  /**
@@ -24,6 +25,7 @@ const ItemList = forwardRef(
24
25
  }: ItemListProps,
25
26
  ref,
26
27
  ) => {
28
+ useScreenRegistry('ItemList');
27
29
  const { gutterSize, numberOfColumns } = useContext(GridContext);
28
30
  const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
29
31
  const numColumns = Math.floor(numberOfColumns / widthItem);
@@ -4,6 +4,7 @@ import Item from './Item';
4
4
  import { GridContext } from './index';
5
5
  import styles from './styles';
6
6
  import { SpanNumber } from './types';
7
+ import { useScreenRegistry } from './utils';
7
8
 
8
9
  export interface ItemSectionListProps extends SectionListProps<any> {
9
10
  /**
@@ -19,6 +20,7 @@ const ItemSectionList: FC<ItemSectionListProps> = ({
19
20
  contentContainerStyle,
20
21
  ...props
21
22
  }) => {
23
+ useScreenRegistry('ItemSectionList');
22
24
  const { gutterSize, numberOfColumns } = useContext(GridContext);
23
25
  const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
24
26
  const _renderItem = (item: any) => {