@momo-kits/foundation 0.169.7-beta.3 → 0.169.7-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.
- package/Application/BottomSheet.hooks.ts +8 -8
- package/Application/BottomSheet.parts.tsx +34 -44
- package/Application/BottomSheet.tsx +37 -40
- package/Application/BottomTab/ActiveIndicator.tsx +14 -15
- package/Application/BottomTab/BottomTabBar.tsx +62 -49
- package/Application/BottomTab/BottomTabInset.tsx +4 -8
- package/Application/BottomTab/CurvedContainer.tsx +12 -14
- package/Application/BottomTab/CustomBottomTabItem.tsx +13 -13
- package/Application/BottomTab/DuoBarCompression.tsx +19 -13
- package/Application/BottomTab/DuoRailTabBar.tsx +24 -20
- package/Application/BottomTab/DuoTabBar.tsx +10 -8
- package/Application/BottomTab/TabBarIcon.tsx +29 -15
- package/Application/BottomTab/TabScreen.tsx +5 -1
- package/Application/BottomTab/index.tsx +30 -33
- package/Application/BottomTab/metrics.ts +23 -23
- package/Application/BottomTab/tabItems.ts +1 -1
- package/Application/BottomTab/usePressLift.ts +2 -2
- package/Application/Components/BackgroundImageView.tsx +0 -4
- package/Application/Components/DuoGlassBackground.tsx +4 -5
- package/Application/Components/HeaderAnimated.tsx +0 -4
- package/Application/Components/HeaderBackground.tsx +0 -4
- package/Application/Components/HeaderExtendHeader.tsx +10 -11
- package/Application/Components/HeaderLeft.tsx +1 -2
- package/Application/Components/HeaderRight.tsx +1 -2
- package/Application/Components/HeaderTitle.shared.ts +9 -11
- package/Application/Components/HeaderTitle.tsx +3 -4
- package/Application/Components/HeaderToolkitAction.tsx +20 -17
- package/Application/Components/NavigationButton.tsx +1 -2
- package/Application/Components/SearchHeader.tsx +10 -17
- package/Application/Components/TitleJourney.tsx +2 -2
- package/Application/Components/TitleLocation.tsx +2 -2
- package/Application/Components/TitleUser.tsx +2 -2
- package/Application/Components/useToolkitActions.tsx +32 -17
- package/Application/KitAdoption/AdoptionBadge.tsx +119 -0
- package/Application/KitAdoption/AdoptionProbe.tsx +166 -0
- package/Application/KitAdoption/AdoptionStore.ts +80 -0
- package/Application/KitAdoption/Authorship/utils.ts +137 -0
- package/Application/KitAdoption/Slots/utils.ts +68 -0
- package/Application/KitAdoption/constants.ts +120 -0
- package/Application/KitAdoption/index.ts +12 -0
- package/Application/KitAdoption/styles.ts +55 -0
- package/Application/KitAdoption/types.ts +61 -0
- package/Application/KitAdoption/utils.ts +376 -0
- package/Application/Localize.ts +0 -7
- package/Application/ModalScreen.tsx +10 -10
- package/Application/Navigation.ts +16 -14
- package/Application/NavigationContainer.tsx +18 -19
- package/Application/Navigator.ts +48 -20
- package/Application/ScaleSizeProvider.tsx +6 -13
- package/Application/StackScreen.tracking.ts +33 -11
- package/Application/StackScreen.tsx +54 -10
- package/Application/TooltipPortal.tsx +5 -12
- package/Application/WidgetContainer.tsx +4 -10
- package/Application/__tests__/KitAdoption.integration.test.tsx +253 -0
- package/Application/__tests__/KitAdoption.test.ts +283 -0
- package/Application/__tests__/KitAdoptionAuthorship.test.ts +132 -0
- package/Application/__tests__/KitAdoptionStore.test.ts +110 -0
- package/Application/__tests__/KitAdoptionStructural.test.ts +193 -0
- package/Application/__tests__/modalLayout.test.ts +128 -0
- package/Application/modalLayout.ts +14 -16
- package/Application/navigationOptions.tsx +17 -21
- package/Badge/Badge.tsx +0 -5
- package/Badge/BadgeDot.tsx +0 -1
- package/Badge/BadgeDotAnimation.tsx +7 -15
- package/Badge/BadgeRibbon.tsx +38 -46
- package/Badge/Shape.tsx +0 -2
- package/Badge/types.ts +2 -2
- package/Button/index.tsx +16 -5
- package/Button/utils.ts +15 -9
- package/CheckBox/index.tsx +0 -4
- package/Consts/theme.ts +10 -10
- package/Context/index.ts +1 -5
- package/Divider/DashDivider.tsx +0 -1
- package/Divider/index.tsx +0 -4
- package/FoundationList/index.tsx +0 -4
- package/Icon/index.tsx +6 -6
- package/Icon/types.ts +1 -1
- package/IconButton/index.tsx +12 -4
- package/Image/index.tsx +7 -9
- package/Input/Input.tsx +9 -8
- package/Input/InputDropDown.tsx +12 -10
- package/Input/InputMoney.tsx +8 -12
- package/Input/InputMoneyView.tsx +7 -14
- package/Input/InputOTP.tsx +33 -35
- package/Input/InputPhoneNumber.tsx +9 -8
- package/Input/InputSearch.tsx +6 -4
- package/Input/InputTextArea.tsx +0 -4
- package/Input/SearchTextTyping.tsx +0 -4
- package/Input/SystemTextInput.tsx +2 -7
- package/Input/TextTyping.tsx +0 -4
- package/Input/common.tsx +12 -26
- package/Input/index.tsx +20 -17
- package/Input/moneyUtils.ts +4 -10
- package/Input/styles.ts +5 -0
- package/Input/utils.ts +12 -14
- package/Layout/Card.tsx +4 -7
- package/Layout/FloatingButton.tsx +0 -4
- package/Layout/Item.tsx +2 -6
- package/Layout/ItemList.tsx +7 -9
- package/Layout/ItemSectionList.tsx +1 -2
- package/Layout/ReservedRegions.tsx +25 -25
- package/Layout/Screen.tsx +58 -56
- package/Layout/Section.tsx +5 -8
- package/Layout/TrackingScope.tsx +0 -1
- package/Layout/screenContent.tsx +2 -4
- package/Layout/screenFooter.tsx +18 -28
- package/Layout/screenHeader.tsx +31 -34
- package/Layout/screenQuickReturn.tsx +20 -17
- package/Layout/screenScroll.ts +7 -4
- package/Layout/screenTypes.ts +2 -3
- package/Layout/types.ts +4 -2
- package/Layout/utils.ts +37 -31
- package/Loader/DotLoader.tsx +0 -4
- package/Loader/Loader.tsx +0 -4
- package/Loader/ProgressBar.tsx +0 -1
- package/Loader/Spinner.tsx +0 -4
- package/Loader/utils.ts +7 -11
- package/Pagination/Dot.tsx +0 -4
- package/Pagination/PaginationDot.tsx +0 -1
- package/Pagination/PaginationNumber.tsx +3 -5
- package/Pagination/PaginationScroll.tsx +0 -5
- package/Pagination/PaginationWhiteDot.tsx +0 -1
- package/Pagination/index.tsx +0 -4
- package/Pagination/types.ts +2 -2
- package/Popup/PopupNotify.tsx +49 -45
- package/Popup/PopupPromotion.tsx +7 -4
- package/Popup/types.ts +4 -4
- package/Popup/utils.ts +4 -11
- package/Radio/index.tsx +0 -4
- package/Skeleton/index.tsx +0 -8
- package/Switch/index.tsx +0 -1
- package/Tag/index.tsx +1 -5
- package/Tag/types.ts +3 -3
- package/Text/index.tsx +3 -14
- package/Text/styles.ts +1 -1
- package/Text/types.ts +6 -1
- package/Text/utils.ts +4 -20
- package/Title/index.tsx +32 -41
- package/ViewBoundary/index.tsx +2 -4
- package/index.ts +6 -0
- package/package.json +1 -1
package/Popup/utils.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
type HighlightSegment = { text: string;
|
|
1
|
+
type HighlightSegment = { text: string; highlight: boolean };
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* True for cased-script letters, digits and `_`; caseless scripts (CJK, Thai)
|
|
5
|
-
* count as word breaks.
|
|
6
|
-
*/
|
|
7
3
|
const isWordChar = (char?: string) => {
|
|
8
4
|
if (!char) {
|
|
9
5
|
return false;
|
|
@@ -46,15 +42,12 @@ const splitHighlightText = (
|
|
|
46
42
|
continue;
|
|
47
43
|
}
|
|
48
44
|
if (start > lastIndex) {
|
|
49
|
-
segments.push({
|
|
50
|
-
text: text.slice(lastIndex, start),
|
|
51
|
-
isHighlighted: false,
|
|
52
|
-
});
|
|
45
|
+
segments.push({ text: text.slice(lastIndex, start), highlight: false });
|
|
53
46
|
}
|
|
54
|
-
segments.push({ text: match[0],
|
|
47
|
+
segments.push({ text: match[0], highlight: true });
|
|
55
48
|
lastIndex = end;
|
|
56
49
|
}
|
|
57
|
-
segments.push({ text: text.slice(lastIndex),
|
|
50
|
+
segments.push({ text: text.slice(lastIndex), highlight: false });
|
|
58
51
|
return segments;
|
|
59
52
|
};
|
|
60
53
|
|
package/Radio/index.tsx
CHANGED
|
@@ -11,10 +11,6 @@ import {
|
|
|
11
11
|
MiniAppContext,
|
|
12
12
|
} from '../Context';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Radio button, selected when `value === groupValue`. `onChange` is called on
|
|
16
|
-
* press without arguments; the parent updates `groupValue`.
|
|
17
|
-
*/
|
|
18
14
|
const Radio: FC<RadioProps> = ({
|
|
19
15
|
value,
|
|
20
16
|
groupValue,
|
package/Skeleton/index.tsx
CHANGED
|
@@ -21,10 +21,6 @@ import { Colors, Styles } from '../Consts';
|
|
|
21
21
|
import styles from './styles';
|
|
22
22
|
import { ScreenContext, SkeletonContext } from '../Context';
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* Shimmering placeholder that fills its parent. Reports loading to the screen
|
|
26
|
-
* context while mounted.
|
|
27
|
-
*/
|
|
28
24
|
const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
29
25
|
const screen = useContext<any>(ScreenContext);
|
|
30
26
|
const [width, setWidth] = useState(0);
|
|
@@ -88,10 +84,6 @@ const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
|
88
84
|
);
|
|
89
85
|
};
|
|
90
86
|
|
|
91
|
-
/**
|
|
92
|
-
* Shares `loading` with descendants (e.g. `Image` shows a skeleton) and animates
|
|
93
|
-
* the layout change when it flips.
|
|
94
|
-
*/
|
|
95
87
|
const SkeletonProvider: React.FC<{ loading: boolean; children: any }> = ({
|
|
96
88
|
loading = true,
|
|
97
89
|
children,
|
package/Switch/index.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import { Colors } from '../Consts';
|
|
|
6
6
|
import { useComponentId } from '../Application';
|
|
7
7
|
import { ComponentContext, MiniAppContext } from '../Context';
|
|
8
8
|
|
|
9
|
-
/** On/off toggle; `onChange` receives the negated `value`. */
|
|
10
9
|
const Switch: FC<SwitchProps> = ({
|
|
11
10
|
value = false,
|
|
12
11
|
onChange,
|
package/Tag/index.tsx
CHANGED
|
@@ -25,10 +25,6 @@ const textColor = {
|
|
|
25
25
|
grey: Colors.black_12,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* Small status label with an optional leading icon. `customColor` replaces the
|
|
30
|
-
* palette color and turns the text white.
|
|
31
|
-
*/
|
|
32
28
|
const Tag: FC<TagProps> = ({
|
|
33
29
|
label = 'Label',
|
|
34
30
|
icon,
|
|
@@ -76,7 +72,7 @@ const Tag: FC<TagProps> = ({
|
|
|
76
72
|
`${componentName}/${label}`,
|
|
77
73
|
accessibilityLabel,
|
|
78
74
|
);
|
|
79
|
-
//
|
|
75
|
+
//Check if custom color is [color]_03 (only check in dev mode)
|
|
80
76
|
const validateCustomColor = (hex: string) => {
|
|
81
77
|
if (__DEV__) {
|
|
82
78
|
const colorCore: { [key: string]: string } = Colors;
|
package/Tag/types.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type TagProps = {
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* `size`: Optional. Defines the size of the Tag component.
|
|
11
|
-
* Defaults to '
|
|
11
|
+
* Defaults to 'medium' if not provided.
|
|
12
12
|
*/
|
|
13
13
|
size?: 'medium' | 'large';
|
|
14
14
|
|
|
@@ -29,8 +29,8 @@ export type TagProps = {
|
|
|
29
29
|
style?: ViewStyle;
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* `customColor`: Optional.
|
|
33
|
-
*
|
|
32
|
+
* `customColor`: Optional. Represents a custom color string (e.g., hex, rgb, rgba, etc.)
|
|
33
|
+
* that can be applied to the Tag component.
|
|
34
34
|
*/
|
|
35
35
|
customColor?: string;
|
|
36
36
|
|
package/Text/index.tsx
CHANGED
|
@@ -111,10 +111,6 @@ const deprecatedValues: Typography[] = [
|
|
|
111
111
|
'action_s',
|
|
112
112
|
];
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
* Text style of a typography token with sizes scaled by `useScaleSize` and the
|
|
116
|
-
* font file name for its weight. Calls hooks, so it only runs during render.
|
|
117
|
-
*/
|
|
118
114
|
const TypoStyles = (typo: Typography, newFontFamily?: string) => {
|
|
119
115
|
const { theme } = useContext(ApplicationContext);
|
|
120
116
|
const styleSheet: {
|
|
@@ -162,7 +158,9 @@ const TypoStyles = (typo: Typography, newFontFamily?: string) => {
|
|
|
162
158
|
fontSize: useScaleSize(fontSize),
|
|
163
159
|
lineHeight: useScaleSize(lineHeight),
|
|
164
160
|
fontStyle,
|
|
165
|
-
//
|
|
161
|
+
// fontFamily da mang san weight. Tren Android, ReactFontManager doi
|
|
162
|
+
// `fonts/<family>_bold.ttf` khi fontWeight >= 700; file do khong ton tai nen
|
|
163
|
+
// font se roi ve font he thong. Bo fontWeight de Android dung dung file.
|
|
166
164
|
fontWeight: undefined,
|
|
167
165
|
};
|
|
168
166
|
};
|
|
@@ -171,11 +169,6 @@ const skeletonStyles = StyleSheet.create({
|
|
|
171
169
|
overlay: { position: 'absolute' },
|
|
172
170
|
});
|
|
173
171
|
|
|
174
|
-
/**
|
|
175
|
-
* Design-system text: renders a `typography` token in the theme font with
|
|
176
|
-
* scaled sizes and OS font scaling off. Warns on deprecated tokens and shows a
|
|
177
|
-
* skeleton overlay while a SkeletonContext is loading.
|
|
178
|
-
*/
|
|
179
172
|
const Text: React.FC<TextProps> = ({
|
|
180
173
|
typography = 'body_default_regular',
|
|
181
174
|
color,
|
|
@@ -235,10 +228,6 @@ const Text: React.FC<TextProps> = ({
|
|
|
235
228
|
);
|
|
236
229
|
};
|
|
237
230
|
|
|
238
|
-
/**
|
|
239
|
-
* Theme font family for a loose weight name ('bold', 'semibold', 'regular').
|
|
240
|
-
* The `typography` argument is ignored; it calls hooks, so use it during render.
|
|
241
|
-
*/
|
|
242
231
|
const exportFontFamily = (
|
|
243
232
|
fontWeight: string,
|
|
244
233
|
typography?: Typography,
|
package/Text/styles.ts
CHANGED
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
action_s_bold: { fontSize: 14, lineHeight: 20, fontWeight: '700' },
|
|
40
40
|
action_xs_bold: { fontSize: 12, lineHeight: 18, fontWeight: '700' },
|
|
41
41
|
action_xxs_bold: { fontSize: 10, lineHeight: 14, fontWeight: '700' },
|
|
42
|
-
|
|
42
|
+
/**non-support**/
|
|
43
43
|
headline_default: {
|
|
44
44
|
fontSize: 28,
|
|
45
45
|
lineHeight: 34,
|
package/Text/types.ts
CHANGED
|
@@ -14,7 +14,9 @@ export type TypographyWeight = {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type Typography =
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
**/
|
|
18
20
|
| 'headline_default'
|
|
19
21
|
| 'headline_l'
|
|
20
22
|
| 'headline_xl'
|
|
@@ -27,6 +29,9 @@ export type Typography =
|
|
|
27
29
|
| 'paragraph_italic'
|
|
28
30
|
| 'label_xxs'
|
|
29
31
|
| 'action_s'
|
|
32
|
+
/**
|
|
33
|
+
* end
|
|
34
|
+
**/
|
|
30
35
|
| 'headline_l_bold'
|
|
31
36
|
| 'headline_default_bold'
|
|
32
37
|
| 'header_m_bold'
|
package/Text/utils.ts
CHANGED
|
@@ -6,28 +6,16 @@ const DEFAULT_SCREEN_SIZE = 375;
|
|
|
6
6
|
const MAX_FONT_SCALE = 1.5;
|
|
7
7
|
const MAX_DEVICE_SCALE = 5;
|
|
8
8
|
|
|
9
|
-
type MiniAppScale = {
|
|
10
|
-
scaleSizeMaxRate?: number;
|
|
11
|
-
fontScale?: { useOSScaleRate?: boolean; userScaleRate?: number };
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Scales `size` by screen width (+5 max) and OS font scale (max `scaleRate`,
|
|
16
|
-
* else the ScaleSizeProvider rate, else 1.5), taking the larger, or by the mini
|
|
17
|
-
* app `fontScale.userScaleRate`; a provider rate caps both at `size × rate`.
|
|
18
|
-
*/
|
|
19
9
|
const useScaleSize = (size: number, scaleRate?: number) => {
|
|
20
10
|
const { width } = useWindowDimensions();
|
|
21
|
-
const context = useContext<
|
|
22
|
-
const scaleSizeMaxRate = context?.scaleSizeMaxRate;
|
|
23
|
-
const maxSize = scaleSizeMaxRate ? size * scaleSizeMaxRate : Infinity;
|
|
11
|
+
const context = useContext<any>(MiniAppContext);
|
|
24
12
|
if (context?.fontScale?.useOSScaleRate === false) {
|
|
25
|
-
return
|
|
13
|
+
return size * (context.fontScale.userScaleRate ?? 1);
|
|
26
14
|
}
|
|
27
15
|
const fontScale = PixelRatio.getFontScale();
|
|
28
16
|
const deviceScale = width / DEFAULT_SCREEN_SIZE;
|
|
29
17
|
|
|
30
|
-
const maxScaleRate = scaleRate ??
|
|
18
|
+
const maxScaleRate = scaleRate ?? MAX_FONT_SCALE;
|
|
31
19
|
|
|
32
20
|
let fontSizeDeviceScale = size;
|
|
33
21
|
let fontSizeOSScale = size;
|
|
@@ -46,13 +34,9 @@ const useScaleSize = (size: number, scaleRate?: number) => {
|
|
|
46
34
|
);
|
|
47
35
|
}
|
|
48
36
|
|
|
49
|
-
return Math.
|
|
37
|
+
return Math.max(fontSizeDeviceScale, fontSizeOSScale);
|
|
50
38
|
};
|
|
51
39
|
|
|
52
|
-
/**
|
|
53
|
-
* Non-hook `useScaleSize` with the default cap and no mini app rate, for use
|
|
54
|
-
* outside render. Reads the window width at call time, so it misses resizes.
|
|
55
|
-
*/
|
|
56
40
|
const scaleSize = (size: number) => {
|
|
57
41
|
const fontScale = PixelRatio.getFontScale();
|
|
58
42
|
const deviceScale = Dimensions.get('window').width / DEFAULT_SCREEN_SIZE;
|
package/Title/index.tsx
CHANGED
|
@@ -15,11 +15,6 @@ import styles from './styles';
|
|
|
15
15
|
import { TitleProps } from './types';
|
|
16
16
|
import { Typography } from '../Text/types';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Section or card heading with optional icon, badge, description, trailing
|
|
20
|
-
* chevron and right action (chevron, or a text button when `buttonTitle` is
|
|
21
|
-
* set). `textOnly` renders the title text alone.
|
|
22
|
-
*/
|
|
23
18
|
const Title: FC<TitleProps> = ({
|
|
24
19
|
accessibilityLabel,
|
|
25
20
|
title = 'Title',
|
|
@@ -48,6 +43,7 @@ const Title: FC<TitleProps> = ({
|
|
|
48
43
|
|
|
49
44
|
const size18 = useScaleSize(18);
|
|
50
45
|
const size22 = useScaleSize(22);
|
|
46
|
+
// Dynamic styles using useScaleSize hook
|
|
51
47
|
const dynamicStyles = {
|
|
52
48
|
card_small: {
|
|
53
49
|
fontSize: useScaleSize(14),
|
|
@@ -208,44 +204,39 @@ const Title: FC<TitleProps> = ({
|
|
|
208
204
|
|
|
209
205
|
const lineHeight = styleSheet[typography].lineHeight;
|
|
210
206
|
|
|
211
|
-
let action = (
|
|
212
|
-
<TouchableOpacity
|
|
213
|
-
onPress={onPressRightAction}
|
|
214
|
-
style={[
|
|
215
|
-
styles.iconRight,
|
|
216
|
-
{
|
|
217
|
-
backgroundColor: theme.colors.primary + '0F',
|
|
218
|
-
},
|
|
219
|
-
]}
|
|
220
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
221
|
-
>
|
|
222
|
-
<Icon
|
|
223
|
-
source={'arrow_chevron_right_small'}
|
|
224
|
-
size={size22}
|
|
225
|
-
color={theme.colors.primary}
|
|
226
|
-
/>
|
|
227
|
-
</TouchableOpacity>
|
|
228
|
-
);
|
|
229
|
-
if (buttonTitle) {
|
|
230
|
-
action = (
|
|
231
|
-
<TouchableOpacity
|
|
232
|
-
onPress={onPressRightAction}
|
|
233
|
-
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
234
|
-
>
|
|
235
|
-
<Text
|
|
236
|
-
color={theme.colors.primary}
|
|
237
|
-
typography={buttonTypo}
|
|
238
|
-
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
239
|
-
>
|
|
240
|
-
{buttonTitle}
|
|
241
|
-
</Text>
|
|
242
|
-
</TouchableOpacity>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
207
|
return (
|
|
247
208
|
<View style={[styles.actionRightView, { height: lineHeight }]}>
|
|
248
|
-
{
|
|
209
|
+
{!buttonTitle ? (
|
|
210
|
+
<TouchableOpacity
|
|
211
|
+
onPress={onPressRightAction}
|
|
212
|
+
style={[
|
|
213
|
+
styles.iconRight,
|
|
214
|
+
{
|
|
215
|
+
backgroundColor: theme.colors.primary + '0F',
|
|
216
|
+
},
|
|
217
|
+
]}
|
|
218
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
219
|
+
>
|
|
220
|
+
<Icon
|
|
221
|
+
source={'arrow_chevron_right_small'}
|
|
222
|
+
size={size22}
|
|
223
|
+
color={theme.colors.primary}
|
|
224
|
+
/>
|
|
225
|
+
</TouchableOpacity>
|
|
226
|
+
) : (
|
|
227
|
+
<TouchableOpacity
|
|
228
|
+
onPress={onPressRightAction}
|
|
229
|
+
accessibilityLabel={componentId + '|label-right-action-touch'}
|
|
230
|
+
>
|
|
231
|
+
<Text
|
|
232
|
+
color={theme.colors.primary}
|
|
233
|
+
typography={buttonTypo}
|
|
234
|
+
accessibilityLabel={componentId + '|label-right-action-text'}
|
|
235
|
+
>
|
|
236
|
+
{buttonTitle}
|
|
237
|
+
</Text>
|
|
238
|
+
</TouchableOpacity>
|
|
239
|
+
)}
|
|
249
240
|
</View>
|
|
250
241
|
);
|
|
251
242
|
};
|
package/ViewBoundary/index.tsx
CHANGED
|
@@ -14,10 +14,6 @@ interface ViewBoundaryState {
|
|
|
14
14
|
error: Error | null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Error boundary: renders `fallback` (or nothing) after a render error and
|
|
19
|
-
* reports it to native `MiniAppModule.onJSBoundaryCrash` when available.
|
|
20
|
-
*/
|
|
21
17
|
class ViewBoundary extends React.Component<
|
|
22
18
|
ViewBoundaryProps,
|
|
23
19
|
ViewBoundaryState
|
|
@@ -37,6 +33,7 @@ class ViewBoundary extends React.Component<
|
|
|
37
33
|
this.props.onError?.(error, errorInfo);
|
|
38
34
|
|
|
39
35
|
const context = (this as any).context ?? {};
|
|
36
|
+
// check exist native module method onJSBoundaryCrash
|
|
40
37
|
const nativeMethod = NativeModules?.MiniAppModule?.onJSBoundaryCrash;
|
|
41
38
|
if (typeof nativeMethod === 'function') {
|
|
42
39
|
try {
|
|
@@ -52,6 +49,7 @@ class ViewBoundary extends React.Component<
|
|
|
52
49
|
componentStack: errorInfo?.componentStack?.substring(0, 500) ?? '',
|
|
53
50
|
},
|
|
54
51
|
});
|
|
52
|
+
console.info('[ViewBoundary] onJSBoundaryCrash success!');
|
|
55
53
|
} catch (_e) {
|
|
56
54
|
console.warn('[ViewBoundary] onJSBoundaryCrash failed:', _e);
|
|
57
55
|
}
|
package/index.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* native export
|
|
3
|
+
*/
|
|
1
4
|
import { TouchableOpacity } from 'react-native';
|
|
2
5
|
|
|
3
6
|
export * from 'react-native-linear-gradient';
|
|
4
7
|
export * from 'react-native-safe-area-context';
|
|
5
8
|
|
|
9
|
+
/**
|
|
10
|
+
* foundation component
|
|
11
|
+
*/
|
|
6
12
|
export * from './Consts';
|
|
7
13
|
export * from './Context';
|
|
8
14
|
export * from './Layout';
|