@momo-kits/foundation 0.156.2-adoption.1 → 0.157.1-beta.2-viewboundary-test
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.
- package/Badge/Badge.tsx +0 -2
- package/Badge/BadgeDot.tsx +0 -2
- package/Badge/BadgeDotAnimation.tsx +0 -2
- package/Badge/BadgeRibbon.tsx +0 -2
- package/Button/index.tsx +0 -2
- package/CheckBox/index.tsx +0 -2
- package/Context/index.ts +0 -10
- package/Divider/DashDivider.tsx +0 -2
- package/Divider/index.tsx +1 -3
- package/Icon/index.tsx +0 -2
- package/IconButton/index.tsx +0 -1
- package/Image/index.tsx +0 -2
- package/Input/Input.tsx +0 -2
- package/Input/InputDropDown.tsx +0 -2
- package/Input/InputMoney.tsx +0 -2
- package/Input/InputOTP.tsx +0 -2
- package/Input/InputPhoneNumber.tsx +0 -2
- package/Input/InputSearch.tsx +1 -5
- package/Input/InputTextArea.tsx +0 -2
- package/Layout/Card.tsx +1 -2
- package/Layout/FloatingButton.tsx +0 -2
- package/Layout/Item.tsx +0 -2
- package/Layout/ItemList.tsx +0 -2
- package/Layout/ItemSectionList.tsx +0 -2
- package/Layout/Screen.tsx +70 -268
- package/Layout/Section.tsx +1 -2
- package/Layout/TrackingScope.tsx +0 -2
- package/Layout/index.ts +1 -2
- package/Layout/utils.ts +2 -15
- package/Loader/DotLoader.tsx +0 -2
- package/Loader/Loader.tsx +1 -3
- package/Loader/ProgressBar.tsx +0 -2
- package/Loader/Spinner.tsx +0 -2
- package/Pagination/Dot.tsx +0 -2
- package/Pagination/PaginationDot.tsx +0 -2
- package/Pagination/PaginationNumber.tsx +0 -2
- package/Pagination/PaginationScroll.tsx +0 -2
- package/Pagination/PaginationWhiteDot.tsx +0 -2
- package/Popup/PopupNotify.tsx +0 -2
- package/Popup/PopupPromotion.tsx +0 -2
- package/Radio/index.tsx +1 -2
- package/Skeleton/index.tsx +0 -2
- package/Switch/index.tsx +0 -2
- package/Tag/index.tsx +0 -2
- package/Text/index.tsx +0 -2
- package/ViewBoundary/index.tsx +45 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/internal.ts +0 -2
package/Badge/Badge.tsx
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
|
|
11
10
|
const Badge: FC<BadgeProps> = ({
|
|
12
11
|
label = '',
|
|
@@ -14,7 +13,6 @@ const Badge: FC<BadgeProps> = ({
|
|
|
14
13
|
backgroundColor,
|
|
15
14
|
accessibilityLabel,
|
|
16
15
|
}) => {
|
|
17
|
-
useScreenRegistry('Badge');
|
|
18
16
|
const { theme } = useContext(ApplicationContext);
|
|
19
17
|
const context = useContext<any>(MiniAppContext);
|
|
20
18
|
const { componentId } = useComponentId('Badge', accessibilityLabel);
|
package/Badge/BadgeDot.tsx
CHANGED
|
@@ -3,10 +3,8 @@ 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';
|
|
7
6
|
|
|
8
7
|
const BadgeDot: FC<BadgeDotProps> = ({ size = 'large', style }) => {
|
|
9
|
-
useScreenRegistry('BadgeDot');
|
|
10
8
|
const context = useContext<any>(MiniAppContext);
|
|
11
9
|
let dotStyle;
|
|
12
10
|
let dotContainerStyle;
|
|
@@ -2,12 +2,10 @@ 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';
|
|
6
5
|
|
|
7
6
|
const DURATION = 500;
|
|
8
7
|
|
|
9
8
|
const BadgeDotAnimation = ({ size, style }: BadgeDotProps) => {
|
|
10
|
-
useScreenRegistry('BadgeDotAnimation');
|
|
11
9
|
// Refs for animated values
|
|
12
10
|
const scaleAnim = useRef(new Animated.Value(1)).current;
|
|
13
11
|
const waveScaleAnim = useRef(new Animated.Value(1)).current;
|
package/Badge/BadgeRibbon.tsx
CHANGED
|
@@ -7,7 +7,6 @@ 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';
|
|
11
10
|
|
|
12
11
|
const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
13
12
|
position = 'top_right',
|
|
@@ -15,7 +14,6 @@ const BadgeRibbon: FC<BadgeRibbonProps> = ({
|
|
|
15
14
|
isRound = false,
|
|
16
15
|
style = {},
|
|
17
16
|
}) => {
|
|
18
|
-
useScreenRegistry('BadgeRibbon');
|
|
19
17
|
const { theme } = useContext(ApplicationContext);
|
|
20
18
|
const context = useContext<any>(MiniAppContext);
|
|
21
19
|
const isRight = position === 'top_right' || position === 'bottom_right';
|
package/Button/index.tsx
CHANGED
|
@@ -28,7 +28,6 @@ import Reanimated, {
|
|
|
28
28
|
useSharedValue,
|
|
29
29
|
withTiming,
|
|
30
30
|
} from 'react-native-reanimated';
|
|
31
|
-
import { useScreenRegistry } from '../Layout';
|
|
32
31
|
|
|
33
32
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
34
33
|
|
|
@@ -74,7 +73,6 @@ const Button: FC<ButtonProps> = ({
|
|
|
74
73
|
}) => {
|
|
75
74
|
const { theme, config } = useContext(ApplicationContext);
|
|
76
75
|
const context = useContext<any>(MiniAppContext);
|
|
77
|
-
useScreenRegistry('Button');
|
|
78
76
|
const skeleton = useContext(SkeletonContext);
|
|
79
77
|
const animationRef = useRef<LottieView>(null);
|
|
80
78
|
const pressAnim = useSharedValue(0);
|
package/CheckBox/index.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
} from '../Context';
|
|
11
11
|
import { Text } from '../Text';
|
|
12
12
|
import { Icon } from '../Icon';
|
|
13
|
-
import { useScreenRegistry } from '../Layout';
|
|
14
13
|
|
|
15
14
|
const CheckBox: FC<CheckBoxProps> = ({
|
|
16
15
|
value,
|
|
@@ -25,7 +24,6 @@ const CheckBox: FC<CheckBoxProps> = ({
|
|
|
25
24
|
}) => {
|
|
26
25
|
const { theme } = useContext(ApplicationContext);
|
|
27
26
|
const context = useContext<any>(MiniAppContext);
|
|
28
|
-
useScreenRegistry('CheckBox');
|
|
29
27
|
const haveValue = value || indeterminate;
|
|
30
28
|
const iconSource = indeterminate ? 'ic_minus' : 'ic_checked';
|
|
31
29
|
let borderColor = theme.colors.text.default;
|
package/Context/index.ts
CHANGED
|
@@ -2,17 +2,8 @@ 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
|
-
|
|
10
5
|
const Context = createContext({});
|
|
11
6
|
const ApplicationContext = createContext(defaultContext);
|
|
12
|
-
const ScreenRegistryContext = createContext<ScreenRegistryContextType>({
|
|
13
|
-
register: () => {},
|
|
14
|
-
unregister: () => {},
|
|
15
|
-
});
|
|
16
7
|
|
|
17
8
|
const MiniAppContext = (Platform as any).MiniAppContext ?? Context;
|
|
18
9
|
const ScreenContext = (Platform as any).ScreenContext ?? Context;
|
|
@@ -29,7 +20,6 @@ export {
|
|
|
29
20
|
ApplicationContext,
|
|
30
21
|
MiniAppContext,
|
|
31
22
|
ScreenContext,
|
|
32
|
-
ScreenRegistryContext,
|
|
33
23
|
ComponentContext,
|
|
34
24
|
SkeletonContext,
|
|
35
25
|
TrackingScopeContext,
|
package/Divider/DashDivider.tsx
CHANGED
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
|
|
8
7
|
export interface DashDividerProps {
|
|
9
8
|
/**
|
|
@@ -13,7 +12,6 @@ export interface DashDividerProps {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
const DashDivider: React.FC<DashDividerProps> = ({ style }) => {
|
|
16
|
-
useScreenRegistry('DashDivider');
|
|
17
15
|
const { theme } = useContext(ApplicationContext);
|
|
18
16
|
const borderColor = theme.colors.border.default;
|
|
19
17
|
|
package/Divider/index.tsx
CHANGED
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
|
|
8
7
|
export interface DividerProps {
|
|
9
8
|
/**
|
|
@@ -26,9 +25,8 @@ const Divider: React.FC<DividerProps> = ({
|
|
|
26
25
|
}) => {
|
|
27
26
|
const { theme } = useContext(ApplicationContext);
|
|
28
27
|
|
|
29
|
-
useScreenRegistry('Divider');
|
|
30
|
-
|
|
31
28
|
if (type === 'dash') return <DashDivider style={style} />;
|
|
29
|
+
|
|
32
30
|
return (
|
|
33
31
|
<View
|
|
34
32
|
style={[
|
package/Icon/index.tsx
CHANGED
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
|
|
11
10
|
const Icon: React.FC<IconProps> = ({
|
|
12
11
|
source = 'ic_back',
|
|
@@ -17,7 +16,6 @@ const Icon: React.FC<IconProps> = ({
|
|
|
17
16
|
}) => {
|
|
18
17
|
const { theme } = useContext(ApplicationContext);
|
|
19
18
|
const context = useContext<any>(MiniAppContext);
|
|
20
|
-
useScreenRegistry('Icon');
|
|
21
19
|
|
|
22
20
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
23
21
|
|
package/IconButton/index.tsx
CHANGED
package/Image/index.tsx
CHANGED
|
@@ -12,7 +12,6 @@ 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';
|
|
16
15
|
|
|
17
16
|
type Status = 'success' | 'loading' | 'error';
|
|
18
17
|
|
|
@@ -37,7 +36,6 @@ const Image: React.FC<ImageProps> = ({
|
|
|
37
36
|
const skeleton = useContext(SkeletonContext);
|
|
38
37
|
const error = useRef(false);
|
|
39
38
|
const [status, setStatus] = useState<Status>('success');
|
|
40
|
-
useScreenRegistry('Image');
|
|
41
39
|
|
|
42
40
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
43
41
|
|
package/Input/Input.tsx
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
ComponentContext,
|
|
32
32
|
MiniAppContext,
|
|
33
33
|
} from '../Context';
|
|
34
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* Input default component
|
|
@@ -73,7 +72,6 @@ const Input = forwardRef(
|
|
|
73
72
|
}: InputProps,
|
|
74
73
|
ref,
|
|
75
74
|
) => {
|
|
76
|
-
useScreenRegistry('Input');
|
|
77
75
|
const { theme } = useContext(ApplicationContext);
|
|
78
76
|
const context = useContext<any>(MiniAppContext);
|
|
79
77
|
const scaledFontSize = useScaleSize(14);
|
package/Input/InputDropDown.tsx
CHANGED
|
@@ -17,7 +17,6 @@ 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';
|
|
21
20
|
|
|
22
21
|
const InputDropDown = ({
|
|
23
22
|
value,
|
|
@@ -39,7 +38,6 @@ const InputDropDown = ({
|
|
|
39
38
|
multiline,
|
|
40
39
|
...props
|
|
41
40
|
}: InputDropDownProps) => {
|
|
42
|
-
useScreenRegistry('InputDropDown');
|
|
43
41
|
const { theme } = useContext(ApplicationContext);
|
|
44
42
|
const context = useContext<any>(MiniAppContext);
|
|
45
43
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
package/Input/InputMoney.tsx
CHANGED
|
@@ -34,7 +34,6 @@ 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';
|
|
38
37
|
|
|
39
38
|
const InputMoney = forwardRef(
|
|
40
39
|
(
|
|
@@ -66,7 +65,6 @@ const InputMoney = forwardRef(
|
|
|
66
65
|
}: InputMoneyProps,
|
|
67
66
|
ref,
|
|
68
67
|
) => {
|
|
69
|
-
useScreenRegistry('InputMoney');
|
|
70
68
|
const { theme } = useContext(ApplicationContext);
|
|
71
69
|
const context = useContext<any>(MiniAppContext);
|
|
72
70
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
package/Input/InputOTP.tsx
CHANGED
|
@@ -28,7 +28,6 @@ import {
|
|
|
28
28
|
ComponentContext,
|
|
29
29
|
MiniAppContext,
|
|
30
30
|
} from '../Context';
|
|
31
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
32
31
|
|
|
33
32
|
const OTPCaret: FC<CaretProps> = ({ index, length }) => {
|
|
34
33
|
const DURATION = 300;
|
|
@@ -91,7 +90,6 @@ const InputOTP = forwardRef(
|
|
|
91
90
|
}: InputOTPProps,
|
|
92
91
|
ref,
|
|
93
92
|
) => {
|
|
94
|
-
useScreenRegistry('InputOTP');
|
|
95
93
|
const MAX_LENGTH = 10;
|
|
96
94
|
const [value, setValue] = useState('');
|
|
97
95
|
const [focused, setFocused] = useState(false);
|
|
@@ -33,7 +33,6 @@ 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';
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
38
|
* Input default component
|
|
@@ -66,7 +65,6 @@ const InputPhoneNumber = forwardRef(
|
|
|
66
65
|
}: InputPhoneNumberProps,
|
|
67
66
|
ref,
|
|
68
67
|
) => {
|
|
69
|
-
useScreenRegistry('InputPhoneNumber');
|
|
70
68
|
const { theme } = useContext(ApplicationContext);
|
|
71
69
|
const context = useContext<any>(MiniAppContext);
|
|
72
70
|
const scaleHeight = useScaleSize(size === 'small' ? 48 : 56, 1.1);
|
package/Input/InputSearch.tsx
CHANGED
|
@@ -28,7 +28,6 @@ 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';
|
|
32
31
|
|
|
33
32
|
const TextTyping: FC<any> = ({
|
|
34
33
|
data = [],
|
|
@@ -142,7 +141,6 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
142
141
|
},
|
|
143
142
|
ref,
|
|
144
143
|
) => {
|
|
145
|
-
useScreenRegistry('InputSearch');
|
|
146
144
|
const { theme } = useContext(ApplicationContext);
|
|
147
145
|
const context = useContext<any>(MiniAppContext);
|
|
148
146
|
const scaledFontSize = useScaleSize(14);
|
|
@@ -350,6 +348,4 @@ const InputSearch: ForwardRefRenderFunction<InputRef, InputSearchProps> = (
|
|
|
350
348
|
);
|
|
351
349
|
};
|
|
352
350
|
|
|
353
|
-
|
|
354
|
-
ForwardedInputSearch.displayName = 'InputSearch';
|
|
355
|
-
export default ForwardedInputSearch;
|
|
351
|
+
export default forwardRef(InputSearch);
|
package/Input/InputTextArea.tsx
CHANGED
|
@@ -22,7 +22,6 @@ 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';
|
|
26
25
|
|
|
27
26
|
const InputTextArea = forwardRef(
|
|
28
27
|
(
|
|
@@ -48,7 +47,6 @@ const InputTextArea = forwardRef(
|
|
|
48
47
|
}: InputTextAreaProps,
|
|
49
48
|
ref,
|
|
50
49
|
) => {
|
|
51
|
-
useScreenRegistry('InputTextArea');
|
|
52
50
|
const componentName = 'InputTextArea';
|
|
53
51
|
|
|
54
52
|
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
|
|
3
|
+
import { useGridSystem } from './utils';
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext, GridSystem } from './index';
|
|
6
6
|
import { Image } from '../Image';
|
|
@@ -27,7 +27,6 @@ const Card: React.FC<CardProps> = ({
|
|
|
27
27
|
useShadow = false,
|
|
28
28
|
...props
|
|
29
29
|
}) => {
|
|
30
|
-
useScreenRegistry('Card');
|
|
31
30
|
const { showGrid, theme } = useContext(ApplicationContext);
|
|
32
31
|
const { numberOfColumns } = useGridSystem();
|
|
33
32
|
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
} from 'react-native';
|
|
15
15
|
import { ApplicationContext } from '../Context';
|
|
16
16
|
import { Icon } from '../Icon';
|
|
17
|
-
import { useScreenRegistry } from './utils';
|
|
18
17
|
|
|
19
18
|
export interface FloatingButtonProps {
|
|
20
19
|
label?: string;
|
|
@@ -39,7 +38,6 @@ export const FloatingButton: React.FC<FloatingButtonProps> = ({
|
|
|
39
38
|
animatedValue,
|
|
40
39
|
bottom = 12,
|
|
41
40
|
}: FloatingButtonProps) => {
|
|
42
|
-
useScreenRegistry('FloatingButton');
|
|
43
41
|
const { theme } = useContext(ApplicationContext);
|
|
44
42
|
const maxWidth = useRef(0);
|
|
45
43
|
const minWidth = size === 'small' ? 36 : 48;
|
package/Layout/Item.tsx
CHANGED
|
@@ -2,7 +2,6 @@ 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';
|
|
6
5
|
import styles from './styles';
|
|
7
6
|
import { SpanNumber } from './types';
|
|
8
7
|
|
|
@@ -24,7 +23,6 @@ const Item: React.FC<ItemProps> = ({
|
|
|
24
23
|
children,
|
|
25
24
|
style,
|
|
26
25
|
}) => {
|
|
27
|
-
useScreenRegistry('Item');
|
|
28
26
|
const { showGrid } = useContext(ApplicationContext);
|
|
29
27
|
const context = useContext<any>(MiniAppContext);
|
|
30
28
|
const grid = useContext(GridContext);
|
package/Layout/ItemList.tsx
CHANGED
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
|
|
9
8
|
export interface ItemListProps extends FlatListProps<any> {
|
|
10
9
|
/**
|
|
@@ -25,7 +24,6 @@ const ItemList = forwardRef(
|
|
|
25
24
|
}: ItemListProps,
|
|
26
25
|
ref,
|
|
27
26
|
) => {
|
|
28
|
-
useScreenRegistry('ItemList');
|
|
29
27
|
const { gutterSize, numberOfColumns } = useContext(GridContext);
|
|
30
28
|
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
31
29
|
const numColumns = Math.floor(numberOfColumns / widthItem);
|
|
@@ -4,7 +4,6 @@ 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';
|
|
8
7
|
|
|
9
8
|
export interface ItemSectionListProps extends SectionListProps<any> {
|
|
10
9
|
/**
|
|
@@ -20,7 +19,6 @@ const ItemSectionList: FC<ItemSectionListProps> = ({
|
|
|
20
19
|
contentContainerStyle,
|
|
21
20
|
...props
|
|
22
21
|
}) => {
|
|
23
|
-
useScreenRegistry('ItemSectionList');
|
|
24
22
|
const { gutterSize, numberOfColumns } = useContext(GridContext);
|
|
25
23
|
const widthItem = (widthSpan ?? numberOfColumns) as SpanNumber;
|
|
26
24
|
const _renderItem = (item: any) => {
|
package/Layout/Screen.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import React, {
|
|
|
9
9
|
useContext,
|
|
10
10
|
useEffect,
|
|
11
11
|
useImperativeHandle,
|
|
12
|
-
useMemo,
|
|
13
12
|
useRef,
|
|
14
13
|
} from 'react';
|
|
15
14
|
import {
|
|
@@ -22,18 +21,12 @@ import {
|
|
|
22
21
|
ScrollViewProps,
|
|
23
22
|
StatusBar,
|
|
24
23
|
StatusBarStyle,
|
|
25
|
-
TouchableOpacity,
|
|
26
24
|
useWindowDimensions,
|
|
27
25
|
View,
|
|
28
26
|
ViewProps,
|
|
29
|
-
Text,
|
|
30
27
|
} from 'react-native';
|
|
31
28
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
32
|
-
import {
|
|
33
|
-
ApplicationContext,
|
|
34
|
-
ScreenContext,
|
|
35
|
-
ScreenRegistryContext,
|
|
36
|
-
} from '../Context';
|
|
29
|
+
import { ApplicationContext, ScreenContext } from '../Context';
|
|
37
30
|
import Navigation from '../Application/Navigation';
|
|
38
31
|
import {
|
|
39
32
|
AnimatedHeader,
|
|
@@ -523,135 +516,6 @@ const Screen = forwardRef(
|
|
|
523
516
|
}
|
|
524
517
|
};
|
|
525
518
|
|
|
526
|
-
const registryRef = useRef<Map<string, string>>(new Map());
|
|
527
|
-
const registeredNamesRef = useRef<Set<string>>(new Set());
|
|
528
|
-
|
|
529
|
-
const register = useCallback((id: string, name: string) => {
|
|
530
|
-
registryRef.current.set(id, name);
|
|
531
|
-
registeredNamesRef.current.add(name);
|
|
532
|
-
}, []);
|
|
533
|
-
|
|
534
|
-
const unregister = useCallback((id: string) => {
|
|
535
|
-
const name = registryRef.current.get(id);
|
|
536
|
-
registryRef.current.delete(id);
|
|
537
|
-
const stillHasName = Array.from(registryRef.current.values()).includes(
|
|
538
|
-
name!,
|
|
539
|
-
);
|
|
540
|
-
if (!stillHasName) {
|
|
541
|
-
registeredNamesRef.current.delete(name!);
|
|
542
|
-
}
|
|
543
|
-
}, []);
|
|
544
|
-
|
|
545
|
-
const registryValue = useMemo(
|
|
546
|
-
() => ({ register, unregister }),
|
|
547
|
-
[register, unregister],
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
const WHITELISTED_COMPONENTS = useMemo(
|
|
551
|
-
() =>
|
|
552
|
-
new Set([
|
|
553
|
-
'View',
|
|
554
|
-
'TouchableOpacity',
|
|
555
|
-
'TouchableHighlight',
|
|
556
|
-
'TouchableWithoutFeedback',
|
|
557
|
-
'Pressable',
|
|
558
|
-
'ScrollView',
|
|
559
|
-
'FlatList',
|
|
560
|
-
'SectionList',
|
|
561
|
-
'SafeAreaView',
|
|
562
|
-
'KeyboardAvoidingView',
|
|
563
|
-
'ActivityIndicator',
|
|
564
|
-
'ImageBackground',
|
|
565
|
-
'Fragment',
|
|
566
|
-
]),
|
|
567
|
-
[],
|
|
568
|
-
);
|
|
569
|
-
|
|
570
|
-
const [usageStats, setUsageStats] = React.useState<{
|
|
571
|
-
total: number;
|
|
572
|
-
internal: number;
|
|
573
|
-
external: number;
|
|
574
|
-
breakdown: Record<string, number>;
|
|
575
|
-
externalNames: string[];
|
|
576
|
-
}>({
|
|
577
|
-
total: 0,
|
|
578
|
-
internal: 0,
|
|
579
|
-
external: 0,
|
|
580
|
-
breakdown: {},
|
|
581
|
-
externalNames: [],
|
|
582
|
-
});
|
|
583
|
-
const [isUsageExpanded, setIsUsageExpanded] = React.useState(false);
|
|
584
|
-
|
|
585
|
-
const countExternalChildren = useCallback(
|
|
586
|
-
(node: React.ReactNode): { count: number; names: string[] } => {
|
|
587
|
-
let count = 0;
|
|
588
|
-
const names: string[] = [];
|
|
589
|
-
const traverse = (n: React.ReactNode) => {
|
|
590
|
-
React.Children.forEach(n, child => {
|
|
591
|
-
if (!React.isValidElement(child)) return;
|
|
592
|
-
const name =
|
|
593
|
-
(child.type as any)?.displayName ||
|
|
594
|
-
(child.type as any)?.name ||
|
|
595
|
-
'';
|
|
596
|
-
if (
|
|
597
|
-
!registeredNamesRef.current.has(name) &&
|
|
598
|
-
!WHITELISTED_COMPONENTS.has(name)
|
|
599
|
-
) {
|
|
600
|
-
count++;
|
|
601
|
-
if (name) {
|
|
602
|
-
names.push(name);
|
|
603
|
-
} else {
|
|
604
|
-
names.push('Anonymous');
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
if ((child as any).props?.children) {
|
|
608
|
-
traverse((child as any).props.children);
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
};
|
|
612
|
-
traverse(node);
|
|
613
|
-
return { count, names };
|
|
614
|
-
},
|
|
615
|
-
[WHITELISTED_COMPONENTS],
|
|
616
|
-
);
|
|
617
|
-
|
|
618
|
-
useEffect(() => {
|
|
619
|
-
if (__DEV__) {
|
|
620
|
-
const allRegistered = Array.from(registryRef.current.values());
|
|
621
|
-
const internal = allRegistered.length;
|
|
622
|
-
const { count: external, names: externalNames } =
|
|
623
|
-
countExternalChildren(children);
|
|
624
|
-
const total = internal + external;
|
|
625
|
-
const counts: Record<string, number> = {};
|
|
626
|
-
allRegistered.forEach(name => {
|
|
627
|
-
counts[name] = (counts[name] || 0) + 1;
|
|
628
|
-
});
|
|
629
|
-
console.log(
|
|
630
|
-
`[Screen] Total: ${total}, Internal: ${internal}, External: ${external}`,
|
|
631
|
-
);
|
|
632
|
-
console.log(`[Screen] Internal components:`, counts);
|
|
633
|
-
if (externalNames.length > 0) {
|
|
634
|
-
console.log(`[Screen] External components:`, externalNames);
|
|
635
|
-
}
|
|
636
|
-
setUsageStats(prev => {
|
|
637
|
-
if (
|
|
638
|
-
prev.total === total &&
|
|
639
|
-
prev.internal === internal &&
|
|
640
|
-
prev.external === external
|
|
641
|
-
) {
|
|
642
|
-
return prev;
|
|
643
|
-
}
|
|
644
|
-
return {
|
|
645
|
-
total,
|
|
646
|
-
internal,
|
|
647
|
-
external,
|
|
648
|
-
breakdown: counts,
|
|
649
|
-
externalNames,
|
|
650
|
-
};
|
|
651
|
-
});
|
|
652
|
-
}
|
|
653
|
-
});
|
|
654
|
-
|
|
655
519
|
/**
|
|
656
520
|
* build content for screen for grid rule
|
|
657
521
|
*/
|
|
@@ -699,144 +563,82 @@ const Screen = forwardRef(
|
|
|
699
563
|
}
|
|
700
564
|
};
|
|
701
565
|
|
|
702
|
-
const renderUsageRate = () => {
|
|
703
|
-
if (!__DEV__ || usageStats.total === 0) return null;
|
|
704
|
-
const rate = Math.round((usageStats.internal / usageStats.total) * 100);
|
|
705
|
-
let color = '#4caf50';
|
|
706
|
-
if (rate < 50) color = '#f44336';
|
|
707
|
-
else if (rate < 80) color = '#ff9800';
|
|
708
|
-
|
|
709
|
-
const hasExternals = usageStats.externalNames.length > 0;
|
|
710
|
-
|
|
711
|
-
return (
|
|
712
|
-
<TouchableOpacity
|
|
713
|
-
activeOpacity={0.8}
|
|
714
|
-
onPress={() => hasExternals && setIsUsageExpanded(prev => !prev)}
|
|
715
|
-
style={{
|
|
716
|
-
position: 'absolute',
|
|
717
|
-
bottom: insets.bottom + 100,
|
|
718
|
-
right: 16,
|
|
719
|
-
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
720
|
-
padding: isUsageExpanded ? 12 : 8,
|
|
721
|
-
borderRadius: 8,
|
|
722
|
-
zIndex: 9999,
|
|
723
|
-
alignItems: 'flex-end',
|
|
724
|
-
minWidth: isUsageExpanded ? 160 : undefined,
|
|
725
|
-
}}
|
|
726
|
-
>
|
|
727
|
-
<Text style={{ color: 'white', fontSize: 12, fontWeight: 'bold' }}>
|
|
728
|
-
Kit Usage: <Text style={{ color }}>{rate}%</Text>
|
|
729
|
-
{hasExternals && !isUsageExpanded && ' ▼'}
|
|
730
|
-
</Text>
|
|
731
|
-
<Text style={{ color: '#ccc', fontSize: 10, marginTop: 4 }}>
|
|
732
|
-
{usageStats.internal} / {usageStats.total} Components
|
|
733
|
-
</Text>
|
|
734
|
-
{isUsageExpanded && hasExternals && (
|
|
735
|
-
<View style={{ marginTop: 8, alignSelf: 'stretch' }}>
|
|
736
|
-
<Text style={{ color: '#aaa', fontSize: 9, marginBottom: 4 }}>
|
|
737
|
-
External ({usageStats.externalNames.length}):
|
|
738
|
-
</Text>
|
|
739
|
-
<Text
|
|
740
|
-
style={{ color: '#f88', fontSize: 10 }}
|
|
741
|
-
numberOfLines={8}
|
|
742
|
-
>
|
|
743
|
-
{usageStats.externalNames.slice(0, 15).join(', ')}
|
|
744
|
-
{usageStats.externalNames.length > 15 &&
|
|
745
|
-
` ... +${usageStats.externalNames.length - 15} more`}
|
|
746
|
-
</Text>
|
|
747
|
-
<Text style={{ color: '#666', fontSize: 9, marginTop: 4 }}>
|
|
748
|
-
Tap to collapse ▲
|
|
749
|
-
</Text>
|
|
750
|
-
</View>
|
|
751
|
-
)}
|
|
752
|
-
</TouchableOpacity>
|
|
753
|
-
);
|
|
754
|
-
};
|
|
755
|
-
|
|
756
566
|
return (
|
|
757
|
-
<
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
567
|
+
<View
|
|
568
|
+
style={[
|
|
569
|
+
Styles.flex,
|
|
570
|
+
{
|
|
571
|
+
backgroundColor: backgroundColor ?? theme.colors.background.default,
|
|
572
|
+
},
|
|
573
|
+
]}
|
|
574
|
+
>
|
|
575
|
+
<HeaderExtendHeader
|
|
576
|
+
headerType={headerType}
|
|
577
|
+
heightHeader={heightHeader}
|
|
578
|
+
headerRightWidth={headerRightWidth}
|
|
579
|
+
animatedValue={animatedValue.current}
|
|
580
|
+
inputSearchProps={inputSearchProps}
|
|
581
|
+
navigation={navigation}
|
|
582
|
+
inputSearchRef={inputSearchRef}
|
|
583
|
+
useShadowHeader={useShadowHeader}
|
|
584
|
+
gradientColor={gradientColor}
|
|
585
|
+
headerBackground={headerBackground}
|
|
586
|
+
/>
|
|
587
|
+
|
|
588
|
+
<KeyboardAvoidingView
|
|
589
|
+
style={Styles.flex}
|
|
590
|
+
enabled={enableKeyboardAvoidingView}
|
|
591
|
+
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
592
|
+
behavior={Platform.select({
|
|
593
|
+
ios: 'padding',
|
|
594
|
+
android: undefined,
|
|
595
|
+
})}
|
|
766
596
|
>
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
gradientColor={gradientColor}
|
|
777
|
-
headerBackground={headerBackground}
|
|
778
|
-
/>
|
|
779
|
-
|
|
780
|
-
<KeyboardAvoidingView
|
|
597
|
+
{Header}
|
|
598
|
+
|
|
599
|
+
<Component
|
|
600
|
+
{...scrollViewProps}
|
|
601
|
+
ref={screenRef}
|
|
602
|
+
showsVerticalScrollIndicator={false}
|
|
603
|
+
onScroll={handleScroll}
|
|
604
|
+
onScrollEndDrag={handleScrollEnd}
|
|
605
|
+
scrollEventThrottle={16}
|
|
781
606
|
style={Styles.flex}
|
|
782
|
-
enabled={enableKeyboardAvoidingView}
|
|
783
|
-
keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
|
|
784
|
-
behavior={Platform.select({
|
|
785
|
-
ios: 'padding',
|
|
786
|
-
android: undefined,
|
|
787
|
-
})}
|
|
788
607
|
>
|
|
789
|
-
{
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
</
|
|
804
|
-
|
|
805
|
-
{floatingButtonProps && (
|
|
806
|
-
<View>
|
|
807
|
-
<FloatingButton
|
|
808
|
-
{...floatingButtonProps}
|
|
809
|
-
animatedValue={animatedValue.current}
|
|
810
|
-
bottom={
|
|
811
|
-
Footer || isTab
|
|
812
|
-
? 12
|
|
813
|
-
: Math.min(insets.bottom, 21) + Spacing.S
|
|
814
|
-
}
|
|
815
|
-
/>
|
|
816
|
-
</View>
|
|
817
|
-
)}
|
|
818
|
-
|
|
819
|
-
{Footer && (
|
|
820
|
-
<View
|
|
821
|
-
style={[
|
|
822
|
-
styles.shadow,
|
|
823
|
-
{
|
|
824
|
-
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
825
|
-
backgroundColor: theme.colors.background.surface,
|
|
826
|
-
},
|
|
827
|
-
]}
|
|
828
|
-
>
|
|
829
|
-
<Section>{Footer}</Section>
|
|
830
|
-
</View>
|
|
831
|
-
)}
|
|
832
|
-
</KeyboardAvoidingView>
|
|
608
|
+
{renderAnimatedHeader()}
|
|
609
|
+
|
|
610
|
+
{useGridLayout ? renderContent(children) : children}
|
|
611
|
+
</Component>
|
|
612
|
+
|
|
613
|
+
{floatingButtonProps && (
|
|
614
|
+
<View>
|
|
615
|
+
<FloatingButton
|
|
616
|
+
{...floatingButtonProps}
|
|
617
|
+
animatedValue={animatedValue.current}
|
|
618
|
+
bottom={
|
|
619
|
+
Footer || isTab ? 12 : Math.min(insets.bottom, 21) + Spacing.S
|
|
620
|
+
}
|
|
621
|
+
/>
|
|
622
|
+
</View>
|
|
623
|
+
)}
|
|
833
624
|
|
|
834
|
-
{
|
|
835
|
-
|
|
836
|
-
|
|
625
|
+
{Footer && (
|
|
626
|
+
<View
|
|
627
|
+
style={[
|
|
628
|
+
styles.shadow,
|
|
629
|
+
{
|
|
630
|
+
paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
|
|
631
|
+
backgroundColor: theme.colors.background.surface,
|
|
632
|
+
},
|
|
633
|
+
]}
|
|
634
|
+
>
|
|
635
|
+
<Section>{Footer}</Section>
|
|
636
|
+
</View>
|
|
637
|
+
)}
|
|
638
|
+
</KeyboardAvoidingView>
|
|
639
|
+
</View>
|
|
837
640
|
);
|
|
838
641
|
},
|
|
839
642
|
);
|
|
840
643
|
|
|
841
|
-
Screen.displayName = 'Screen';
|
|
842
644
|
export default Screen;
|
package/Layout/Section.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
|
|
3
|
+
import { useGridSystem } from './utils';
|
|
4
4
|
import { GridContextProps } from './types';
|
|
5
5
|
import { GridContext } from './index';
|
|
6
6
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
@@ -34,7 +34,6 @@ const Section: React.FC<SectionProps> = ({
|
|
|
34
34
|
style,
|
|
35
35
|
...props
|
|
36
36
|
}) => {
|
|
37
|
-
useScreenRegistry('Section');
|
|
38
37
|
const { showGrid } = useContext(ApplicationContext);
|
|
39
38
|
const { numberOfColumns } = useGridSystem();
|
|
40
39
|
|
package/Layout/TrackingScope.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TrackingScopeContext } from '../Context';
|
|
3
|
-
import { useScreenRegistry } from './utils';
|
|
4
3
|
|
|
5
4
|
const TrackingScope = ({
|
|
6
5
|
scopeName,
|
|
@@ -9,7 +8,6 @@ const TrackingScope = ({
|
|
|
9
8
|
scopeName: string;
|
|
10
9
|
children: any;
|
|
11
10
|
}) => {
|
|
12
|
-
useScreenRegistry('TrackingScope');
|
|
13
11
|
return (
|
|
14
12
|
<TrackingScopeContext.Provider value={{ scopeName }}>
|
|
15
13
|
{children}
|
package/Layout/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Card from './Card';
|
|
2
2
|
import Section from './Section';
|
|
3
3
|
import GridSystem from './GridSystem';
|
|
4
|
-
import { validateChildren
|
|
4
|
+
import { validateChildren } from './utils';
|
|
5
5
|
import { createContext } from 'react';
|
|
6
6
|
import { GridContextProps } from './types';
|
|
7
7
|
import Item from './Item';
|
|
@@ -26,7 +26,6 @@ export {
|
|
|
26
26
|
Section,
|
|
27
27
|
GridSystem,
|
|
28
28
|
validateChildren,
|
|
29
|
-
useScreenRegistry,
|
|
30
29
|
Item,
|
|
31
30
|
ItemList,
|
|
32
31
|
ItemSectionList,
|
package/Layout/utils.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { Fragment, ReactElement
|
|
1
|
+
import React, { Fragment, ReactElement } from 'react';
|
|
2
2
|
import { useWindowDimensions } from 'react-native';
|
|
3
|
-
import { ScreenRegistryContext } from '../Context';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* validate children type
|
|
@@ -45,16 +44,4 @@ const useGridSystem = () => {
|
|
|
45
44
|
return { numberOfColumns };
|
|
46
45
|
};
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const useScreenRegistry = (name: string) => {
|
|
51
|
-
const { register, unregister } = useContext(ScreenRegistryContext);
|
|
52
|
-
const id = useRef(`__sr_${name}_${registryIdCounter++}`).current;
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
register(id, name);
|
|
56
|
-
return () => unregister(id);
|
|
57
|
-
}, [id, name, register, unregister]);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { useGridSystem, validateChildren, useScreenRegistry };
|
|
47
|
+
export { useGridSystem, validateChildren };
|
package/Loader/DotLoader.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import animation from '../Assets/DotAnimation.json';
|
|
|
4
4
|
import { ApplicationContext } from '../Context';
|
|
5
5
|
import { hexToRGBA } from './utils';
|
|
6
6
|
import { LoaderProps } from './types';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const DotLoader: FC<LoaderProps> = ({ color, style }) => {
|
|
10
|
-
useScreenRegistry('DotLoader');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
|
|
13
11
|
const arrayColor = [
|
package/Loader/Loader.tsx
CHANGED
|
@@ -2,10 +2,8 @@ import React, {FC} from 'react';
|
|
|
2
2
|
import {LoaderProps} from './types';
|
|
3
3
|
import DotLoader from './DotLoader';
|
|
4
4
|
import Spinner from './Spinner';
|
|
5
|
-
import { useScreenRegistry } from '../Layout';
|
|
6
5
|
|
|
7
|
-
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
8
|
-
useScreenRegistry('Loader');
|
|
6
|
+
const Loader: FC<LoaderProps> = ({type = 'dot', ...props}) => {
|
|
9
7
|
if (type === 'spinner') {
|
|
10
8
|
return <Spinner {...props} key={props.color} />;
|
|
11
9
|
}
|
package/Loader/ProgressBar.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import styles from './styles';
|
|
|
4
4
|
import { ProgressBarProps } from './types';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
6
|
import { Radius } from '../Consts';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const ProgressBar: FC<ProgressBarProps> = ({ percent = 0, style }) => {
|
|
10
|
-
useScreenRegistry('ProgressBar');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
const animation = useRef(new Animated.Value(0)).current;
|
|
13
11
|
|
package/Loader/Spinner.tsx
CHANGED
|
@@ -4,10 +4,8 @@ import animation from '../Assets/SpinnerAnimation.json';
|
|
|
4
4
|
import { hexToRGBA } from './utils';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
6
|
import { LoaderProps } from './types';
|
|
7
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
8
7
|
|
|
9
8
|
const Spinner: FC<LoaderProps> = ({ color, style }) => {
|
|
10
|
-
useScreenRegistry('Spinner');
|
|
11
9
|
const { theme } = useContext(ApplicationContext);
|
|
12
10
|
|
|
13
11
|
let source: any = animation;
|
package/Pagination/Dot.tsx
CHANGED
|
@@ -3,10 +3,8 @@ import { Animated } from 'react-native';
|
|
|
3
3
|
import styles from './styles';
|
|
4
4
|
import { DotProps } from './types';
|
|
5
5
|
import { ApplicationContext } from '../Context';
|
|
6
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
7
6
|
|
|
8
7
|
const Dot: FC<DotProps> = ({ active, style }) => {
|
|
9
|
-
useScreenRegistry('Dot');
|
|
10
8
|
const { theme } = useContext(ApplicationContext);
|
|
11
9
|
const dotStyle = active
|
|
12
10
|
? [styles.activeDot]
|
|
@@ -5,14 +5,12 @@ import Dot from './Dot';
|
|
|
5
5
|
import styles from './styles';
|
|
6
6
|
import { Spacing } from '../Consts';
|
|
7
7
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationDot: FC<ChildPaginationProps> = ({
|
|
11
10
|
dataLength = 2,
|
|
12
11
|
activeIndex = 0,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationDot');
|
|
16
14
|
const { theme } = useContext(ApplicationContext);
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
|
|
@@ -5,14 +5,12 @@ import styles from './styles';
|
|
|
5
5
|
import { Text } from '../Text';
|
|
6
6
|
import { Colors } from '../Consts';
|
|
7
7
|
import { MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationNumber: FC<ChildPaginationProps> = ({
|
|
11
10
|
activeIndex = 0,
|
|
12
11
|
dataLength = 2,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationNumber');
|
|
16
14
|
const context = useContext<any>(MiniAppContext);
|
|
17
15
|
|
|
18
16
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
@@ -3,7 +3,6 @@ import { Animated, View } from 'react-native';
|
|
|
3
3
|
import { ScrollIndicatorProps } from './types';
|
|
4
4
|
import styles from './styles';
|
|
5
5
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
6
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
7
6
|
|
|
8
7
|
const INDICATOR_WIDTH = 24;
|
|
9
8
|
const INDICATOR_CONTAINER_WIDTH = 72;
|
|
@@ -12,7 +11,6 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
|
|
|
12
11
|
children,
|
|
13
12
|
scrollViewRef,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationScroll');
|
|
16
14
|
const { theme } = useContext(ApplicationContext);
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
const left = useRef(new Animated.Value(0)).current;
|
|
@@ -5,14 +5,12 @@ import styles from './styles';
|
|
|
5
5
|
import Dot from './Dot';
|
|
6
6
|
import { Colors, Spacing } from '../Consts';
|
|
7
7
|
import { MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PaginationWhiteDot: FC<ChildPaginationProps> = ({
|
|
11
10
|
dataLength = 2,
|
|
12
11
|
activeIndex = 0,
|
|
13
12
|
style,
|
|
14
13
|
}) => {
|
|
15
|
-
useScreenRegistry('PaginationWhiteDot');
|
|
16
14
|
const context = useContext<any>(MiniAppContext);
|
|
17
15
|
|
|
18
16
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -14,7 +14,6 @@ import { Image } from '../Image';
|
|
|
14
14
|
import { Text, useScaleSize } from '../Text';
|
|
15
15
|
import { PopupNotifyProps } from './types';
|
|
16
16
|
import { runOnJS } from 'react-native-reanimated';
|
|
17
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
18
17
|
|
|
19
18
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
20
19
|
image,
|
|
@@ -27,7 +26,6 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
27
26
|
onIconClose,
|
|
28
27
|
onRequestClose,
|
|
29
28
|
}) => {
|
|
30
|
-
useScreenRegistry('PopupNotify');
|
|
31
29
|
const context = useContext<any>(MiniAppContext);
|
|
32
30
|
const { theme, navigator, translate } = useContext(ApplicationContext);
|
|
33
31
|
const [scrollContent, setScrollContent] = useState(false);
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import { ApplicationContext, MiniAppContext } from '../Context';
|
|
|
5
5
|
import { Image } from '../Image';
|
|
6
6
|
import { Colors, Radius, Spacing } from '../Consts';
|
|
7
7
|
import { Icon } from '../Icon';
|
|
8
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
9
8
|
|
|
10
9
|
const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
11
10
|
image,
|
|
@@ -13,7 +12,6 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
13
12
|
onRequestClose,
|
|
14
13
|
onActionClick,
|
|
15
14
|
}) => {
|
|
16
|
-
useScreenRegistry('PopupPromotion');
|
|
17
15
|
const context = useContext<any>(MiniAppContext);
|
|
18
16
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
19
17
|
const { width: widthDevice } = Dimensions.get('window');
|
package/Radio/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FC, useContext } from 'react';
|
|
2
2
|
import { TouchableOpacity, View } from 'react-native';
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { RadioProps } from './types';
|
|
5
5
|
import { Text } from '../Text';
|
|
6
6
|
import styles from './styles';
|
|
@@ -24,7 +24,6 @@ const Radio: FC<RadioProps> = ({
|
|
|
24
24
|
accessibilityLabel,
|
|
25
25
|
...props
|
|
26
26
|
}) => {
|
|
27
|
-
useScreenRegistry('Radio');
|
|
28
27
|
const { theme } = useContext(ApplicationContext);
|
|
29
28
|
const context = useContext<any>(MiniAppContext);
|
|
30
29
|
const selected = value === groupValue;
|
package/Skeleton/index.tsx
CHANGED
|
@@ -13,10 +13,8 @@ import { SkeletonTypes } from './types';
|
|
|
13
13
|
import { Colors, Styles } from '../Consts';
|
|
14
14
|
import styles from './styles';
|
|
15
15
|
import { ScreenContext, SkeletonContext } from '../Context';
|
|
16
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
17
16
|
|
|
18
17
|
const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
19
|
-
useScreenRegistry('Skeleton');
|
|
20
18
|
const screen = useContext<any>(ScreenContext);
|
|
21
19
|
const [width, setWidth] = useState(0);
|
|
22
20
|
const PRIMARY_COLOR = Colors.black_05;
|
package/Switch/index.tsx
CHANGED
|
@@ -5,7 +5,6 @@ import styles from './styles';
|
|
|
5
5
|
import { Colors } from '../Consts';
|
|
6
6
|
import { useComponentId } from '../Application';
|
|
7
7
|
import { ComponentContext, MiniAppContext } from '../Context';
|
|
8
|
-
import { useScreenRegistry } from '@momo-kits/foundation';
|
|
9
8
|
|
|
10
9
|
const Switch: FC<SwitchProps> = ({
|
|
11
10
|
value = false,
|
|
@@ -16,7 +15,6 @@ const Switch: FC<SwitchProps> = ({
|
|
|
16
15
|
accessibilityLabel,
|
|
17
16
|
...props
|
|
18
17
|
}) => {
|
|
19
|
-
useScreenRegistry('Switch');
|
|
20
18
|
const context = useContext<any>(MiniAppContext);
|
|
21
19
|
const circleBackgroundColor = value ? Colors.black_01 : Colors.black_03;
|
|
22
20
|
const circleAlign = value ? 'flex-end' : 'flex-start';
|
package/Tag/index.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { FC, useContext } from 'react';
|
|
2
2
|
import { View, StyleSheet } from 'react-native';
|
|
3
3
|
import { TagProps } from './types';
|
|
4
|
-
import { useScreenRegistry } from '../Layout/utils';
|
|
5
4
|
import { Colors, Radius, Spacing } from '../Consts';
|
|
6
5
|
import { Icon } from '../Icon';
|
|
7
6
|
import { Text, useScaleSize } from '../Text';
|
|
@@ -35,7 +34,6 @@ const Tag: FC<TagProps> = ({
|
|
|
35
34
|
customColor,
|
|
36
35
|
accessibilityLabel,
|
|
37
36
|
}) => {
|
|
38
|
-
useScreenRegistry('Tag');
|
|
39
37
|
const context = useContext<any>(MiniAppContext);
|
|
40
38
|
const scaledHeight24 = useScaleSize(24);
|
|
41
39
|
const scaledHeight18 = useScaleSize(18);
|
package/Text/index.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
} from '../Context';
|
|
10
10
|
import { scaleSize, useScaleSize } from './utils';
|
|
11
11
|
import { Skeleton } from '../Skeleton';
|
|
12
|
-
import { useScreenRegistry } from '@momo-kits/foundation';
|
|
13
12
|
|
|
14
13
|
const SFProText: TypographyWeight = {
|
|
15
14
|
100: 'Thin',
|
|
@@ -159,7 +158,6 @@ const Text: React.FC<TextProps> = ({
|
|
|
159
158
|
maxScaleRate,
|
|
160
159
|
...rest
|
|
161
160
|
}) => {
|
|
162
|
-
useScreenRegistry('Text');
|
|
163
161
|
const { theme } = useContext(ApplicationContext);
|
|
164
162
|
const context = useContext<any>(MiniAppContext);
|
|
165
163
|
const skeleton = useContext(SkeletonContext);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, StyleProp } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface ViewBoundaryProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
/** Custom fallback UI when error occurs. Defaults to hiding the crashed view. */
|
|
7
|
+
fallback?: React.ReactNode;
|
|
8
|
+
/** Style for the fallback container */
|
|
9
|
+
fallbackStyle?: StyleProp<ViewStyle>;
|
|
10
|
+
/** Called when an error is caught. Use for logging/reporting. */
|
|
11
|
+
onError?: (error: Error, errorInfo: React.ErrorInfo) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ViewBoundaryState {
|
|
15
|
+
hasError: boolean;
|
|
16
|
+
error: Error | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
class ViewBoundary extends React.Component<ViewBoundaryProps, ViewBoundaryState> {
|
|
20
|
+
constructor(props: ViewBoundaryProps) {
|
|
21
|
+
super(props);
|
|
22
|
+
this.state = { hasError: false, error: null };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static getDerivedStateFromError(error: Error): ViewBoundaryState {
|
|
26
|
+
return { hasError: true, error };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
30
|
+
this.props.onError?.(error, errorInfo);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
if (this.state.hasError) {
|
|
35
|
+
if (this.props.fallback !== undefined) {
|
|
36
|
+
return this.props.fallback;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return this.props.children;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export default ViewBoundary;
|
|
45
|
+
export { ViewBoundary };
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/internal.ts
DELETED