@momo-kits/foundation 0.168.1-rn862.1 → 0.169.2
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 +195 -0
- package/Application/BottomSheet.parts.tsx +147 -0
- package/Application/BottomSheet.styles.ts +43 -0
- package/Application/BottomSheet.tsx +76 -279
- package/Application/BottomTab/ActiveIndicator.tsx +90 -0
- package/Application/BottomTab/BottomTabBar.styles.ts +65 -0
- package/Application/BottomTab/BottomTabBar.tsx +229 -276
- package/Application/BottomTab/BottomTabInset.tsx +14 -0
- package/Application/BottomTab/CurvedContainer.tsx +153 -0
- package/Application/BottomTab/CustomBottomTabItem.tsx +132 -108
- package/Application/BottomTab/DuoBarCompression.tsx +4 -12
- package/Application/BottomTab/DuoRailTabBar.tsx +227 -0
- package/Application/BottomTab/DuoTabBar.styles.ts +81 -0
- package/Application/BottomTab/DuoTabBar.tsx +29 -495
- package/Application/BottomTab/TabBarIcon.tsx +160 -72
- package/Application/BottomTab/TabScreen.tsx +164 -0
- package/Application/BottomTab/index.tsx +84 -351
- package/Application/BottomTab/metrics.ts +164 -0
- package/Application/BottomTab/tabItems.ts +46 -0
- package/Application/BottomTab/usePressLift.ts +32 -0
- package/Application/Components/DuoGlassBackground.tsx +7 -9
- package/Application/Components/HeaderAnimated.tsx +1 -1
- package/Application/Components/HeaderBackground.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +17 -11
- package/Application/Components/HeaderRight.styles.ts +144 -0
- package/Application/Components/HeaderRight.tsx +6 -528
- package/Application/Components/HeaderTitle.shared.ts +43 -0
- package/Application/Components/HeaderTitle.styles.ts +125 -0
- package/Application/Components/HeaderTitle.tsx +12 -576
- package/Application/Components/HeaderToolkitAction.tsx +208 -0
- package/Application/Components/NavigationButton.tsx +9 -6
- package/Application/Components/SearchHeader.tsx +1 -1
- package/Application/Components/SwipeBackHaptic.tsx +95 -0
- package/Application/Components/TitleJourney.tsx +110 -0
- package/Application/Components/TitleLocation.tsx +73 -0
- package/Application/Components/TitleUser.tsx +304 -0
- package/Application/Components/useToolkitActions.tsx +233 -0
- package/Application/ModalIconButton.tsx +66 -0
- package/Application/ModalScreen.tsx +39 -18
- package/Application/Navigation.ts +1 -1
- package/Application/NavigationContainer.tsx +7 -8
- package/Application/StackScreen.tracking.ts +158 -0
- package/Application/StackScreen.tsx +10 -137
- package/Application/WidgetContainer.tsx +10 -3
- package/Application/__tests__/modalLayout.test.ts +128 -0
- package/Application/hooks.ts +137 -0
- package/Application/index.ts +13 -1
- package/Application/modalLayout.ts +177 -0
- package/Application/navigationOptions.tsx +217 -0
- package/Application/types.header.ts +116 -0
- package/Application/types.tabs.ts +48 -0
- package/Application/types.theme.ts +87 -0
- package/Application/types.ts +12 -244
- package/Application/utils.ts +107 -0
- package/Badge/BadgeRibbon.tsx +3 -3
- package/Badge/styles.ts +2 -0
- package/Button/index.tsx +16 -136
- package/Button/styles.ts +1 -1
- package/Button/utils.ts +139 -0
- package/CheckBox/index.tsx +1 -6
- package/Divider/DashDivider.tsx +10 -11
- package/Divider/index.tsx +18 -8
- package/Image/index.tsx +1 -46
- package/Input/Input.tsx +7 -8
- package/Input/InputDropDown.tsx +3 -4
- package/Input/InputMoney.tsx +38 -164
- package/Input/InputMoneyView.tsx +187 -0
- package/Input/InputOTP.tsx +1 -1
- package/Input/InputPhoneNumber.tsx +5 -1
- package/Input/InputSearch.tsx +2 -108
- package/Input/InputTextArea.tsx +1 -5
- package/Input/SearchTextTyping.tsx +104 -0
- package/Input/common.tsx +4 -4
- package/Input/moneyUtils.ts +17 -0
- package/Input/styles.ts +26 -2
- package/Layout/FloatingButton.tsx +22 -21
- package/Layout/ReservedRegions.tsx +21 -4
- package/Layout/Screen.tsx +74 -670
- package/Layout/Section.tsx +1 -2
- package/Layout/index.ts +10 -4
- package/Layout/layoutMetrics.ts +58 -0
- package/Layout/layoutTypes.ts +86 -0
- package/Layout/screenContent.tsx +90 -0
- package/Layout/screenFooter.tsx +53 -0
- package/Layout/screenHeader.tsx +315 -0
- package/Layout/screenQuickReturn.tsx +67 -0
- package/Layout/screenScroll.ts +110 -0
- package/Layout/screenTypes.ts +134 -0
- package/Layout/styles.ts +2 -0
- package/Layout/utils.ts +10 -144
- package/Loader/DotLoader.tsx +7 -3
- package/Loader/ProgressBar.tsx +2 -6
- package/Loader/Spinner.tsx +7 -3
- package/Loader/styles.ts +4 -0
- package/Popup/PopupNotify.tsx +70 -64
- package/Popup/PopupPromotion.tsx +5 -4
- package/Popup/types.ts +7 -0
- package/Popup/utils.ts +46 -24
- package/Radio/index.tsx +2 -10
- package/Radio/styles.ts +6 -0
- package/Skeleton/index.tsx +1 -9
- package/Skeleton/styles.ts +1 -0
- package/Tag/index.tsx +3 -3
- package/Text/index.tsx +11 -2
- package/Title/index.tsx +2 -9
- package/Title/styles.ts +6 -0
- package/package.json +21 -22
- package/Application/device.ts +0 -29
- package/Application/utils.tsx +0 -497
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import React, { useContext, useRef, useState } from 'react';
|
|
2
|
-
import { ScrollView, StyleSheet,
|
|
2
|
+
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { ApplicationContext, MiniAppContext } from '../Context';
|
|
4
4
|
import { Button } from '../Button';
|
|
5
|
-
import { Colors,
|
|
6
|
-
import { Icon } from '../Icon';
|
|
5
|
+
import { Colors, Spacing, Styles } from '../Consts';
|
|
7
6
|
import { Image } from '../Image';
|
|
8
7
|
import { Text, useScaleSize } from '../Text';
|
|
9
8
|
import { PopupNotifyProps } from './types';
|
|
10
9
|
import { scheduleOnRN } from 'react-native-worklets';
|
|
11
|
-
import {
|
|
10
|
+
import { useModalLayout } from '../Application/modalLayout';
|
|
11
|
+
import { ModalIconButton } from '../Application/ModalIconButton';
|
|
12
|
+
import { splitHighlightText } from './utils';
|
|
12
13
|
|
|
13
14
|
const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
14
15
|
image,
|
|
15
16
|
title = 'Title',
|
|
16
17
|
description = 'Description',
|
|
18
|
+
highlightText,
|
|
17
19
|
error,
|
|
18
20
|
secondary,
|
|
19
21
|
primary,
|
|
@@ -24,15 +26,19 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
24
26
|
const context = useContext<any>(MiniAppContext);
|
|
25
27
|
const { theme, navigator, translate } = useContext(ApplicationContext);
|
|
26
28
|
const [scrollContent, setScrollContent] = useState(false);
|
|
27
|
-
const
|
|
28
|
-
const maxHeight =
|
|
29
|
+
const { isFoldable, popup } = useModalLayout();
|
|
30
|
+
const { width: popupWidth, maxHeight, radius } = popup;
|
|
29
31
|
const scaledMaxHeight = useScaleSize(172);
|
|
30
32
|
|
|
31
33
|
const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
|
|
32
34
|
const closeAction = useRef('touch_outside');
|
|
33
35
|
let descriptionStyle = {};
|
|
34
36
|
let Description: any = View;
|
|
35
|
-
if (
|
|
37
|
+
if (isFoldable) {
|
|
38
|
+
// foldables cap the popup height, the description takes what is left
|
|
39
|
+
Description = ScrollView;
|
|
40
|
+
descriptionStyle = styles.shrink;
|
|
41
|
+
} else if (scrollContent) {
|
|
36
42
|
Description = ScrollView;
|
|
37
43
|
descriptionStyle = { maxHeight: scaledMaxHeight };
|
|
38
44
|
}
|
|
@@ -134,48 +140,68 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
134
140
|
return renderColumn();
|
|
135
141
|
};
|
|
136
142
|
|
|
143
|
+
/**
|
|
144
|
+
* build description text, highlighted keywords keep size/lineHeight and use weight 600
|
|
145
|
+
*/
|
|
146
|
+
const renderDescription = (text: string) => {
|
|
147
|
+
const segments = splitHighlightText(text, highlightText);
|
|
148
|
+
if (!segments) {
|
|
149
|
+
return text;
|
|
150
|
+
}
|
|
151
|
+
return segments.map((segment, index) => {
|
|
152
|
+
if (segment.highlight) {
|
|
153
|
+
return (
|
|
154
|
+
<Text key={index} typography={'header_s_semibold'}>
|
|
155
|
+
{segment.text}
|
|
156
|
+
</Text>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return segment.text;
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
137
163
|
/**
|
|
138
164
|
* build close action
|
|
139
165
|
*/
|
|
140
166
|
const buildCloseIcon = () => {
|
|
141
|
-
if (typeof onIconClose
|
|
142
|
-
return
|
|
143
|
-
<TouchableOpacity
|
|
144
|
-
accessibilityLabel={'ic_popup_close'}
|
|
145
|
-
style={styles.iconCloseContainer}
|
|
146
|
-
onPress={() => {
|
|
147
|
-
closeAction.current = 'icon_close';
|
|
148
|
-
onAction(onIconClose);
|
|
149
|
-
}}
|
|
150
|
-
>
|
|
151
|
-
<View
|
|
152
|
-
style={[
|
|
153
|
-
styles.iconClose,
|
|
154
|
-
{
|
|
155
|
-
backgroundColor: theme.colors.text.default,
|
|
156
|
-
borderColor: theme.colors.background.surface,
|
|
157
|
-
},
|
|
158
|
-
]}
|
|
159
|
-
>
|
|
160
|
-
<Icon
|
|
161
|
-
source="navigation_close"
|
|
162
|
-
color={theme.colors.background.surface}
|
|
163
|
-
size={14}
|
|
164
|
-
/>
|
|
165
|
-
</View>
|
|
166
|
-
</TouchableOpacity>
|
|
167
|
-
);
|
|
167
|
+
if (typeof onIconClose !== 'function') {
|
|
168
|
+
return null;
|
|
168
169
|
}
|
|
170
|
+
return (
|
|
171
|
+
<ModalIconButton
|
|
172
|
+
icon="navigation_close"
|
|
173
|
+
accessibilityLabel={'ic_popup_close'}
|
|
174
|
+
style={styles.iconClose}
|
|
175
|
+
onPress={() => {
|
|
176
|
+
closeAction.current = 'icon_close';
|
|
177
|
+
onAction(onIconClose);
|
|
178
|
+
}}
|
|
179
|
+
/>
|
|
180
|
+
);
|
|
169
181
|
};
|
|
170
182
|
|
|
171
183
|
const body = (
|
|
172
184
|
<>
|
|
173
|
-
{!!image &&
|
|
174
|
-
|
|
185
|
+
{!!image && (
|
|
186
|
+
<Image
|
|
187
|
+
source={{ uri: image }}
|
|
188
|
+
style={[
|
|
189
|
+
styles.image,
|
|
190
|
+
{ borderTopLeftRadius: radius, borderTopRightRadius: radius },
|
|
191
|
+
]}
|
|
192
|
+
/>
|
|
193
|
+
)}
|
|
194
|
+
<View style={[styles.content, isFoldable && styles.shrink]}>
|
|
175
195
|
<Text
|
|
176
196
|
typography={'header_default_bold'}
|
|
177
197
|
numberOfLines={3}
|
|
178
198
|
accessibilityLabel={'title_popup_notify'}
|
|
199
|
+
// keeps the title clear of the close button on a text only popup
|
|
200
|
+
style={
|
|
201
|
+
!image &&
|
|
202
|
+
typeof onIconClose === 'function' &&
|
|
203
|
+
styles.titleClearClose
|
|
204
|
+
}
|
|
179
205
|
>
|
|
180
206
|
{title}
|
|
181
207
|
</Text>
|
|
@@ -191,7 +217,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
191
217
|
}
|
|
192
218
|
}}
|
|
193
219
|
>
|
|
194
|
-
{description}
|
|
220
|
+
{renderDescription(description)}
|
|
195
221
|
</Text>
|
|
196
222
|
) : (
|
|
197
223
|
description
|
|
@@ -218,23 +244,16 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
218
244
|
<View
|
|
219
245
|
accessibilityLabel={'popup_notify'}
|
|
220
246
|
style={[
|
|
221
|
-
styles.container,
|
|
222
247
|
{
|
|
223
248
|
backgroundColor: theme.colors.background.surface,
|
|
249
|
+
borderRadius: radius,
|
|
224
250
|
width: popupWidth,
|
|
225
251
|
maxHeight,
|
|
226
252
|
},
|
|
227
253
|
showBaseLineDebug && styles.debugBaseLine,
|
|
228
254
|
]}
|
|
229
255
|
>
|
|
230
|
-
{
|
|
231
|
-
body
|
|
232
|
-
) : (
|
|
233
|
-
// scrolls when iPhone Duo landscape is too short; actions stay visible
|
|
234
|
-
<ScrollView style={styles.body} bounces={false}>
|
|
235
|
-
{body}
|
|
236
|
-
</ScrollView>
|
|
237
|
-
)}
|
|
256
|
+
{body}
|
|
238
257
|
<View style={styles.contentAction}>{buildAction()}</View>
|
|
239
258
|
{buildCloseIcon()}
|
|
240
259
|
</View>
|
|
@@ -242,17 +261,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
242
261
|
};
|
|
243
262
|
|
|
244
263
|
const styles = StyleSheet.create({
|
|
245
|
-
container: {
|
|
246
|
-
borderRadius: Radius.L,
|
|
247
|
-
},
|
|
248
264
|
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
249
265
|
image: {
|
|
250
|
-
borderTopLeftRadius: Radius.L,
|
|
251
|
-
borderTopRightRadius: Radius.L,
|
|
252
266
|
aspectRatio: 1.7777,
|
|
253
267
|
overflow: 'hidden',
|
|
254
268
|
},
|
|
255
|
-
|
|
269
|
+
shrink: { flexShrink: 1 },
|
|
256
270
|
content: { padding: Spacing.XL },
|
|
257
271
|
description: {
|
|
258
272
|
marginTop: Spacing.S,
|
|
@@ -268,19 +282,11 @@ const styles = StyleSheet.create({
|
|
|
268
282
|
width: Spacing.S,
|
|
269
283
|
height: Spacing.S,
|
|
270
284
|
},
|
|
271
|
-
|
|
272
|
-
position: 'absolute',
|
|
273
|
-
top: -Spacing.M,
|
|
274
|
-
right: -Spacing.M,
|
|
275
|
-
padding: Spacing.XS,
|
|
276
|
-
},
|
|
285
|
+
titleClearClose: { paddingRight: Spacing.XL },
|
|
277
286
|
iconClose: {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
justifyContent: 'center',
|
|
282
|
-
borderRadius: Radius.M,
|
|
283
|
-
borderWidth: 2,
|
|
287
|
+
position: 'absolute',
|
|
288
|
+
top: Spacing.M,
|
|
289
|
+
right: Spacing.M,
|
|
284
290
|
},
|
|
285
291
|
});
|
|
286
292
|
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -5,7 +5,7 @@ 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 {
|
|
8
|
+
import { useModalLayout } from '../Application/modalLayout';
|
|
9
9
|
|
|
10
10
|
const ASPECT_RATIO = 0.72;
|
|
11
11
|
const ICON_CLOSE_SIZE = 20;
|
|
@@ -20,9 +20,10 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
20
20
|
}) => {
|
|
21
21
|
const context = useContext<any>(MiniAppContext);
|
|
22
22
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const {
|
|
24
|
+
popup: { width: popupWidth, maxHeight },
|
|
25
|
+
} = useModalLayout();
|
|
26
|
+
// fit the portrait image by height when a foldable leaves too little room
|
|
26
27
|
let imageWidth = popupWidth;
|
|
27
28
|
if (maxHeight !== undefined) {
|
|
28
29
|
const heightFitWidth = (maxHeight - CLOSE_ROW_HEIGHT) * ASPECT_RATIO;
|
package/Popup/types.ts
CHANGED
|
@@ -20,6 +20,13 @@ export type PopupNotifyProps = {
|
|
|
20
20
|
*/
|
|
21
21
|
description?: string | React.ReactNode;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* `highlightText`: Optional. List of words/phrases within `description` to be rendered in semibold.
|
|
25
|
+
* Only applies when `description` is a string. Matching is whole-word and case-sensitive;
|
|
26
|
+
* every occurrence of each string is highlighted.
|
|
27
|
+
*/
|
|
28
|
+
highlightText?: string[];
|
|
29
|
+
|
|
23
30
|
/**
|
|
24
31
|
* `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
|
|
25
32
|
*/
|
package/Popup/utils.ts
CHANGED
|
@@ -1,32 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
3
|
-
import { Spacing } from '../Consts';
|
|
4
|
-
import { getDuoTopInset, isIPhoneDuo } from '../Application/device';
|
|
1
|
+
type HighlightSegment = { text: string; highlight: boolean };
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const usePopupWidth = () => {
|
|
10
|
-
const windowSize = useWindowDimensions();
|
|
11
|
-
if (!isIPhoneDuo()) {
|
|
12
|
-
return Dimensions.get('window').width - Spacing.XL * 2;
|
|
3
|
+
const isWordChar = (char?: string) => {
|
|
4
|
+
if (!char) {
|
|
5
|
+
return false;
|
|
13
6
|
}
|
|
14
|
-
|
|
7
|
+
const isLetter = char.toLowerCase() !== char.toUpperCase();
|
|
8
|
+
return isLetter || /[0-9_]/.test(char);
|
|
15
9
|
};
|
|
16
10
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Split `text` into plain/highlighted segments (same matching as Information `highlightText`):
|
|
13
|
+
* whole-word, case-sensitive, every occurrence, longest keyword first.
|
|
14
|
+
* Returns `undefined` when there is nothing to highlight.
|
|
15
|
+
*/
|
|
16
|
+
const splitHighlightText = (
|
|
17
|
+
text: string,
|
|
18
|
+
highlightText?: string[],
|
|
19
|
+
): HighlightSegment[] | undefined => {
|
|
20
|
+
const keywords = highlightText?.filter(keyword => {
|
|
21
|
+
if (typeof keyword !== 'string') {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return keyword.length > 0;
|
|
25
|
+
});
|
|
26
|
+
if (!keywords?.length) {
|
|
22
27
|
return undefined;
|
|
23
28
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const pattern = [...keywords]
|
|
30
|
+
.sort((a, b) => b.length - a.length)
|
|
31
|
+
.map(keyword => keyword.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
32
|
+
.join('|');
|
|
33
|
+
const regex = new RegExp(pattern, 'g');
|
|
34
|
+
const segments: HighlightSegment[] = [];
|
|
35
|
+
let lastIndex = 0;
|
|
36
|
+
let match;
|
|
37
|
+
while ((match = regex.exec(text))) {
|
|
38
|
+
const start = match.index;
|
|
39
|
+
const end = start + match[0].length;
|
|
40
|
+
if (isWordChar(text[start - 1]) || isWordChar(text[end])) {
|
|
41
|
+
regex.lastIndex = start + 1;
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (start > lastIndex) {
|
|
45
|
+
segments.push({ text: text.slice(lastIndex, start), highlight: false });
|
|
46
|
+
}
|
|
47
|
+
segments.push({ text: match[0], highlight: true });
|
|
48
|
+
lastIndex = end;
|
|
49
|
+
}
|
|
50
|
+
segments.push({ text: text.slice(lastIndex), highlight: false });
|
|
51
|
+
return segments;
|
|
30
52
|
};
|
|
31
53
|
|
|
32
|
-
export {
|
|
54
|
+
export { splitHighlightText };
|
package/Radio/index.tsx
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
ComponentContext,
|
|
11
11
|
MiniAppContext,
|
|
12
12
|
} from '../Context';
|
|
13
|
-
import { Spacing } from '../Consts';
|
|
14
13
|
|
|
15
14
|
const Radio: FC<RadioProps> = ({
|
|
16
15
|
value,
|
|
@@ -67,14 +66,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
67
66
|
{...props}
|
|
68
67
|
disabled={disabled}
|
|
69
68
|
onPress={onChange}
|
|
70
|
-
style={[
|
|
71
|
-
style,
|
|
72
|
-
{
|
|
73
|
-
flexDirection: 'row',
|
|
74
|
-
alignItems: 'center',
|
|
75
|
-
},
|
|
76
|
-
showBaseLineDebug && styles.debugBaseLine,
|
|
77
|
-
]}
|
|
69
|
+
style={[style, styles.row, showBaseLineDebug && styles.debugBaseLine]}
|
|
78
70
|
accessibilityState={{
|
|
79
71
|
checked: selected,
|
|
80
72
|
disabled: disabled as boolean,
|
|
@@ -87,7 +79,7 @@ const Radio: FC<RadioProps> = ({
|
|
|
87
79
|
styles.radio,
|
|
88
80
|
checkBoxStyle,
|
|
89
81
|
disabledStyle,
|
|
90
|
-
|
|
82
|
+
label ? styles.radioWithLabel : styles.radioNoLabel,
|
|
91
83
|
]}
|
|
92
84
|
/>
|
|
93
85
|
{!!label && (
|
package/Radio/styles.ts
CHANGED
|
@@ -11,5 +11,11 @@ export default StyleSheet.create({
|
|
|
11
11
|
radioText: {
|
|
12
12
|
marginRight: Spacing.M,
|
|
13
13
|
},
|
|
14
|
+
row: {
|
|
15
|
+
flexDirection: 'row',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
},
|
|
18
|
+
radioWithLabel: { marginRight: Spacing.S },
|
|
19
|
+
radioNoLabel: { marginRight: 0 },
|
|
14
20
|
debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
|
|
15
21
|
});
|
package/Skeleton/index.tsx
CHANGED
|
@@ -65,15 +65,7 @@ const Skeleton: React.FC<SkeletonTypes> = ({ style }) => {
|
|
|
65
65
|
onLayout={e => onLayout(e.nativeEvent.layout.width)}
|
|
66
66
|
style={[Styles.flex, { backgroundColor: PRIMARY_COLOR }]}
|
|
67
67
|
>
|
|
68
|
-
<Animated.View
|
|
69
|
-
style={[
|
|
70
|
-
{
|
|
71
|
-
width: '60%',
|
|
72
|
-
height: '100%',
|
|
73
|
-
},
|
|
74
|
-
shimmerStyle,
|
|
75
|
-
]}
|
|
76
|
-
>
|
|
68
|
+
<Animated.View style={[styles.shimmer, shimmerStyle]}>
|
|
77
69
|
<LinearGradient
|
|
78
70
|
style={[StyleSheet.absoluteFill]}
|
|
79
71
|
colors={shimmerColors}
|
package/Skeleton/styles.ts
CHANGED
package/Tag/index.tsx
CHANGED
|
@@ -73,7 +73,7 @@ const Tag: FC<TagProps> = ({
|
|
|
73
73
|
accessibilityLabel,
|
|
74
74
|
);
|
|
75
75
|
//Check if custom color is [color]_03 (only check in dev mode)
|
|
76
|
-
const validateCustomColor = (
|
|
76
|
+
const validateCustomColor = (hex: string) => {
|
|
77
77
|
if (__DEV__) {
|
|
78
78
|
const colorCore: { [key: string]: string } = Colors;
|
|
79
79
|
const primaryColors = Object.keys(Colors)
|
|
@@ -82,8 +82,8 @@ const Tag: FC<TagProps> = ({
|
|
|
82
82
|
return colorCore[i];
|
|
83
83
|
}
|
|
84
84
|
})
|
|
85
|
-
.filter(
|
|
86
|
-
return primaryColors.includes(
|
|
85
|
+
.filter(item => item);
|
|
86
|
+
return primaryColors.includes(hex);
|
|
87
87
|
}
|
|
88
88
|
return true;
|
|
89
89
|
};
|
package/Text/index.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
Text as RNText,
|
|
5
|
+
TextProps as RNTextProps,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
3
8
|
import styles from './styles';
|
|
4
9
|
import { Typography, TypographyWeight } from './types';
|
|
5
10
|
import {
|
|
@@ -160,6 +165,10 @@ const TypoStyles = (typo: Typography, newFontFamily?: string) => {
|
|
|
160
165
|
};
|
|
161
166
|
};
|
|
162
167
|
|
|
168
|
+
const skeletonStyles = StyleSheet.create({
|
|
169
|
+
overlay: { position: 'absolute' },
|
|
170
|
+
});
|
|
171
|
+
|
|
163
172
|
const Text: React.FC<TextProps> = ({
|
|
164
173
|
typography = 'body_default_regular',
|
|
165
174
|
color,
|
|
@@ -196,7 +205,7 @@ const Text: React.FC<TextProps> = ({
|
|
|
196
205
|
>
|
|
197
206
|
{children ?? ''}
|
|
198
207
|
</RNText>
|
|
199
|
-
<Skeleton style={
|
|
208
|
+
<Skeleton style={skeletonStyles.overlay} />
|
|
200
209
|
</View>
|
|
201
210
|
);
|
|
202
211
|
}
|
package/Title/index.tsx
CHANGED
|
@@ -147,9 +147,7 @@ const Title: FC<TitleProps> = ({
|
|
|
147
147
|
setBadgeWidth(e.nativeEvent.layout.width);
|
|
148
148
|
}
|
|
149
149
|
}}
|
|
150
|
-
style={
|
|
151
|
-
alignItems: 'center',
|
|
152
|
-
}}
|
|
150
|
+
style={styles.badgeView}
|
|
153
151
|
>
|
|
154
152
|
<Badge
|
|
155
153
|
style={styles.badge}
|
|
@@ -207,12 +205,7 @@ const Title: FC<TitleProps> = ({
|
|
|
207
205
|
const lineHeight = styleSheet[typography].lineHeight;
|
|
208
206
|
|
|
209
207
|
return (
|
|
210
|
-
<View
|
|
211
|
-
style={{
|
|
212
|
-
height: lineHeight,
|
|
213
|
-
justifyContent: 'center',
|
|
214
|
-
}}
|
|
215
|
-
>
|
|
208
|
+
<View style={[styles.actionRightView, { height: lineHeight }]}>
|
|
216
209
|
{!buttonTitle ? (
|
|
217
210
|
<TouchableOpacity
|
|
218
211
|
onPress={onPressRightAction}
|
package/Title/styles.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/foundation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.169.2",
|
|
4
4
|
"description": "React Native Component Kits",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {},
|
|
5
7
|
"keywords": [
|
|
6
8
|
"@momo-kits/foundation"
|
|
7
9
|
],
|
|
8
|
-
"license": "MoMo",
|
|
9
|
-
"main": "index.ts",
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"registry": "https://registry.npmjs.org/"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {},
|
|
14
10
|
"dependencies": {
|
|
11
|
+
"react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
|
|
15
12
|
"@react-navigation/bottom-tabs": "7.4.2",
|
|
16
13
|
"@react-navigation/core": "7.12.1",
|
|
17
14
|
"@react-navigation/elements": "2.5.2",
|
|
18
15
|
"@react-navigation/native": "7.1.14",
|
|
19
16
|
"@react-navigation/routers": "7.4.1",
|
|
20
17
|
"@react-navigation/stack": "7.4.2",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"react-native-
|
|
24
|
-
"react-native-
|
|
25
|
-
"react-native-
|
|
26
|
-
"react-native-reanimated": "4.5.3",
|
|
18
|
+
"react-native-gesture-handler": "2.27.1",
|
|
19
|
+
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
20
|
+
"react-native-reanimated": "4.2.2",
|
|
21
|
+
"react-native-worklets": "0.6.1",
|
|
22
|
+
"react-native-safe-area-context": "5.5.2",
|
|
27
23
|
"react-native-reserved-regions": "0.2.0",
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/color": "3.0.6",
|
|
32
|
-
"react-native-reanimated": "4.5.3",
|
|
33
|
-
"react-native-worklets": "0.11.3"
|
|
24
|
+
"@shopify/flash-list": "2.1.0",
|
|
25
|
+
"lottie-react-native": "7.2.4"
|
|
34
26
|
},
|
|
35
27
|
"peerDependencies": {
|
|
36
28
|
"react-native": "*",
|
|
37
|
-
"react-native-
|
|
38
|
-
"react-native-worklets": "
|
|
39
|
-
}
|
|
29
|
+
"react-native-svg": "*",
|
|
30
|
+
"react-native-worklets": "0.6.1"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/color": "3.0.6"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"registry": "https://registry.npmjs.org/"
|
|
37
|
+
},
|
|
38
|
+
"license": "MoMo"
|
|
40
39
|
}
|
package/Application/device.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Dimensions, Platform, ScaledSize } from 'react-native';
|
|
2
|
-
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
3
|
-
|
|
4
|
-
// widest short side of any single-display iPhone
|
|
5
|
-
const IPHONE_MAX_SHORT_SIDE = 440;
|
|
6
|
-
|
|
7
|
-
// iPhone Duo reports idiom "phone"; 'screen' stays on the outer display, so it
|
|
8
|
-
// still matches when Split View narrows the window
|
|
9
|
-
const isIPhoneDuo = () => {
|
|
10
|
-
if (Platform.OS !== 'ios' || Platform.isPad) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
const shortSide = (size: ScaledSize) => Math.min(size.width, size.height);
|
|
14
|
-
return (
|
|
15
|
-
Math.max(
|
|
16
|
-
shortSide(Dimensions.get('screen')),
|
|
17
|
-
shortSide(Dimensions.get('window')),
|
|
18
|
-
) > IPHONE_MAX_SHORT_SIDE
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// portrait side status bar is about twice as tall as its inset is wide
|
|
23
|
-
const getDuoTopInset = (insets: EdgeInsets, width: number, height: number) =>
|
|
24
|
-
Math.max(
|
|
25
|
-
insets.top,
|
|
26
|
-
height > width ? Math.max(insets.left, insets.right) * 2 : 0,
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
export { isIPhoneDuo, getDuoTopInset };
|