@momo-kits/foundation 0.168.1-beta.4 → 0.168.1-beta.40

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.
@@ -9,6 +9,8 @@ import React, {
9
9
  } from 'react';
10
10
  import {
11
11
  Platform,
12
+ Pressable,
13
+ Text,
12
14
  TextInput,
13
15
  TextInputFocusEvent,
14
16
  TouchableOpacity,
@@ -22,7 +24,6 @@ import {
22
24
  } from '../Context';
23
25
  import { Icon } from '../Icon';
24
26
  import { useScaleSize, exportFontFamily } from '../Text';
25
- import { Spacing } from '../Consts';
26
27
  import {
27
28
  ErrorView,
28
29
  FloatingView,
@@ -32,9 +33,26 @@ import {
32
33
  } from './common';
33
34
  import { InputMoneyProps } from './index';
34
35
  import styles from './styles';
35
- import { formatNumberToMoney } from './utils';
36
36
  import SystemTextInput from './SystemTextInput';
37
37
 
38
+ const moneyFormatter = new Intl.NumberFormat('vi-VN');
39
+
40
+ const findEdit = (old: string, text: string) => {
41
+ let start = 0;
42
+ while (start < text.length && old[start] === text[start]) {
43
+ start += 1;
44
+ }
45
+ let suffix = 0;
46
+ while (
47
+ suffix < Math.min(text.length, old.length) - start &&
48
+ old[old.length - 1 - suffix] === text[text.length - 1 - suffix]
49
+ ) {
50
+ suffix += 1;
51
+ }
52
+ const size = old.length + text.length - 2 * (start + suffix);
53
+ return { old, start, suffix, size };
54
+ };
55
+
38
56
  const InputMoney = forwardRef(
39
57
  (
40
58
  {
@@ -76,6 +94,11 @@ const InputMoney = forwardRef(
76
94
  const [lastDisplayValue, setLastDisplayValue] = useState('');
77
95
  const inputRef = useRef<TextInput>(null);
78
96
  const caretDigitsAfter = useRef<number | undefined>(undefined);
97
+ const lastRawText = useRef('');
98
+ const [caretSelection, setCaretSelection] = useState<{
99
+ start: number;
100
+ end: number;
101
+ }>();
79
102
  const componentName = 'InputMoney';
80
103
 
81
104
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
@@ -100,38 +123,34 @@ const InputMoney = forwardRef(
100
123
  }
101
124
  }, [value]);
102
125
 
103
- // Android moves the caret proportionally when the text is replaced, so it
104
- // lands before the typed digit once a separator is added. Put it back after
105
- // the same digit.
106
126
  useEffect(() => {
107
127
  setLastDisplayValue(displayValue);
128
+ }, [displayValue]);
129
+
130
+ useEffect(() => {
131
+ if (!caretSelection) return;
132
+ setCaretSelection(current =>
133
+ current === caretSelection ? undefined : current,
134
+ );
135
+ }, [caretSelection]);
136
+
137
+ const updateDisplayValue = (numeric: string) => {
138
+ const next = numeric ? moneyFormatter.format(Number(numeric)) : '';
139
+ setDisplayValue(next);
140
+
108
141
  const digitsAfter = caretDigitsAfter.current;
109
142
  caretDigitsAfter.current = undefined;
110
143
  if (Platform.OS !== 'android' || digitsAfter === undefined) return;
111
- let before = parseInputText(displayValue).length - digitsAfter;
144
+ let before = parseInputText(next).length - digitsAfter;
112
145
  let caret = 0;
113
- while (before > 0 && caret < displayValue.length) {
114
- if (/\d/.test(displayValue[caret])) before -= 1;
146
+ while (before > 0 && caret < next.length) {
147
+ if (/\d/.test(next[caret])) before -= 1;
115
148
  caret += 1;
116
149
  }
117
- inputRef.current?.setSelection(caret, caret);
118
- }, [displayValue]);
119
-
120
- const updateDisplayValue = (numeric: string) => {
121
- if (!numeric) {
122
- setDisplayValue('');
123
- return;
124
- }
125
- const formatted = formatNumberToMoney(Number(numeric));
126
- setDisplayValue(formatted ? `${formatted}${currency}` : '');
150
+ setCaretSelection({ start: caret, end: caret });
127
151
  };
128
152
 
129
- const parseInputText = (text: string): string => {
130
- if (!text) return '';
131
- const currencyRegex = new RegExp(` ?${currency}$`, 'g');
132
- const textWithoutCurrency = text.replace(currencyRegex, '').trim();
133
- return textWithoutCurrency.replace(/[^\d]/g, '');
134
- };
153
+ const parseInputText = (text: string): string => text.replace(/\D/g, '');
135
154
 
136
155
  const updateNumericValue = (val: string) => {
137
156
  let next = val.replace(/[^\d]/g, '').replace(/^0+(?=\d)/, '');
@@ -153,42 +172,35 @@ const InputMoney = forwardRef(
153
172
 
154
173
  const _onChangeText = (text: string) => {
155
174
  if (!text) {
175
+ lastRawText.current = '';
156
176
  setDisplayValue('');
157
177
  setNumericValue('');
158
178
  onChangeText?.('');
159
179
  return;
160
180
  }
161
- const old = lastDisplayValue;
162
- let start = 0;
163
- while (start < text.length && old[start] === text[start]) {
164
- start += 1;
165
- }
166
- let suffix = 0;
167
- while (
168
- suffix < Math.min(text.length, old.length) - start &&
169
- old[old.length - 1 - suffix] === text[text.length - 1 - suffix]
170
- ) {
171
- suffix += 1;
172
- }
173
- caretDigitsAfter.current = text
174
- .slice(text.length - suffix)
175
- .replace(/\D/g, '').length;
176
- if (text.length < old.length) {
177
- const removed = old.slice(start, old.length - suffix);
178
- if (!/\d/.test(removed)) {
179
- const index = removed.includes('.')
180
- ? parseInputText(old.slice(0, start)).length - 1
181
- : numericValue.length - 1;
182
- if (index >= 0) {
183
- updateNumericValue(
184
- numericValue.slice(0, index) + numericValue.slice(index + 1),
185
- );
186
- }
181
+ const digits = parseInputText(text);
182
+ const raw = lastRawText.current;
183
+ lastRawText.current = text;
184
+ const formattedEdit = findEdit(lastDisplayValue, text);
185
+ const rawEdit = findEdit(raw, text);
186
+ const { old, start, suffix } =
187
+ raw && rawEdit.size < formattedEdit.size ? rawEdit : formattedEdit;
188
+ caretDigitsAfter.current = parseInputText(
189
+ text.slice(text.length - suffix),
190
+ ).length;
191
+ if (text.length < old.length && digits === numericValue) {
192
+ const index = parseInputText(text.slice(0, start)).length - 1;
193
+ if (index >= 0) {
194
+ updateNumericValue(digits.slice(0, index) + digits.slice(index + 1));
187
195
  return;
188
196
  }
189
197
  }
190
- const newNumericValue = parseInputText(text);
191
- updateNumericValue(newNumericValue);
198
+ updateNumericValue(digits);
199
+ };
200
+
201
+ const focusAtEnd = () => {
202
+ inputRef.current?.focus();
203
+ inputRef.current?.setSelection(displayValue.length, displayValue.length);
192
204
  };
193
205
 
194
206
  const _onFocus = (e: TextInputFocusEvent) => {
@@ -232,6 +244,11 @@ const InputMoney = forwardRef(
232
244
  placeholderColor = disabledColor;
233
245
  iconTintColor = disabledColor;
234
246
  }
247
+ const textStyle = {
248
+ fontSize: scaledFontSize,
249
+ fontFamily: inputFontFamily,
250
+ };
251
+ const hasValue = displayValue.length > 0;
235
252
  return (
236
253
  <View
237
254
  style={[
@@ -250,7 +267,11 @@ const InputMoney = forwardRef(
250
267
  onPress={onPressFloatingIcon}
251
268
  componentId={componentId}
252
269
  />
253
- <View style={styles.inputView}>
270
+ <Pressable
271
+ style={[styles.inputView, styles.moneyInputView]}
272
+ onPress={focusAtEnd}
273
+ disabled={disabled}
274
+ >
254
275
  <SystemTextInput
255
276
  {...props}
256
277
  accessibilityLabel={`${componentId}`}
@@ -260,22 +281,11 @@ const InputMoney = forwardRef(
260
281
  disabled: disabled,
261
282
  ...props.accessibilityState,
262
283
  }}
263
- style={[
264
- {
265
- width: '100%',
266
- paddingLeft: Spacing.M,
267
- height: '100%',
268
- fontSize: scaledFontSize,
269
- paddingVertical: Spacing.S,
270
- fontFamily: inputFontFamily,
271
- },
272
- {
273
- color: textColor,
274
- },
275
- ]}
284
+ style={[textStyle, styles.moneyTextInput, { color: textColor }]}
276
285
  allowFontScaling={false}
277
286
  textBreakStrategy="highQuality"
278
287
  value={displayValue}
288
+ selection={caretSelection ?? props.selection}
279
289
  onChangeText={_onChangeText}
280
290
  onFocus={_onFocus}
281
291
  onBlur={_onBlur}
@@ -285,7 +295,15 @@ const InputMoney = forwardRef(
285
295
  keyboardType={'numeric'}
286
296
  maxLength={undefined}
287
297
  />
288
- </View>
298
+ {hasValue ? (
299
+ <Text
300
+ style={[textStyle, { color: textColor }]}
301
+ allowFontScaling={false}
302
+ >
303
+ {currency}
304
+ </Text>
305
+ ) : null}
306
+ </Pressable>
289
307
  <View style={styles.iconView}>
290
308
  {showClearIcon && focused && displayValue ? (
291
309
  <TouchableOpacity
package/Input/common.tsx CHANGED
@@ -112,7 +112,7 @@ export const ErrorView: FC<{
112
112
  color={errorMessage ? errorColor : hintColor}
113
113
  typography={'description_default_regular'}
114
114
  >
115
- {errorMessage ?? hintTextDefault}
115
+ {errorMessage || hintTextDefault}
116
116
  </Text>
117
117
  </View>
118
118
  );
package/Input/styles.ts CHANGED
@@ -218,4 +218,13 @@ export default StyleSheet.create({
218
218
  marginLeft: Spacing.M,
219
219
  },
220
220
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
221
+ moneyInputView: {
222
+ paddingLeft: Spacing.M,
223
+ },
224
+ moneyTextInput: {
225
+ flexShrink: 1,
226
+ paddingLeft: 0,
227
+ paddingRight: Spacing.XXS,
228
+ paddingVertical: 0,
229
+ },
221
230
  });
package/Layout/Screen.tsx CHANGED
@@ -64,6 +64,8 @@ import {
64
64
  import { DuoQuickReturnHeader } from '../Application/Components/DuoQuickReturnHeader';
65
65
  import { useDuoTabBarInset } from '../Application/BottomTab/DuoTabBar';
66
66
 
67
+ const ANIMATED_BANNER_HEIGHT = 210;
68
+
67
69
  export interface ScreenProps extends ViewProps {
68
70
  /**
69
71
  * ReactNode representing the content of the screen.
@@ -222,19 +224,6 @@ const Screen = forwardRef(
222
224
  const frame = useSafeAreaFrame();
223
225
  const heightHeader = useHeaderHeight();
224
226
 
225
- /**
226
- * Dual animation source:
227
- * - `animatedValue` is a react-native `Animated.Value` driven natively by the
228
- * scroll event. It is what legacy consumers receive (`animatedValue`).
229
- * - `sharedValue` is a reanimated `SharedValue` consumed by every internal
230
- * foundation component (and offered to modern consumers). It is kept in
231
- * sync from the scroll `listener` (see below), which fires on the JS
232
- * thread even when the scroll uses the native driver.
233
- * If a legacy value is driven outside of Screen, its listener also
234
- * mirrors JS-driven updates into the shared value.
235
- * Consumers pass only `Animated.Value`; the reanimated shared value stays
236
- * an internal implementation detail.
237
- */
238
227
  const animatedValue = useRef<Animated.Value>(
239
228
  customAnimatedValue ?? new Animated.Value(0),
240
229
  );
@@ -258,7 +247,6 @@ const Screen = forwardRef(
258
247
  const currentTint = useRef<string | undefined>(undefined);
259
248
 
260
249
  const isTab = !!screen?.bottomTab;
261
- // Duo floating tab bar overlays the tab content instead of taking layout space
262
250
  const duoTabInset = useDuoTabBarInset();
263
251
 
264
252
  let handleScroll;
@@ -267,14 +255,12 @@ const Screen = forwardRef(
267
255
  const isIOS = Platform.OS === 'ios';
268
256
  const bottomInset = isIOS ? Math.min(insets.bottom, 21) : insets.bottom;
269
257
  const hasSideBar = !!layout.sideBar;
270
- // iPhone Duo: content scrolls under a glass header instead of starting below it
271
258
  const useDuoGlass =
272
259
  hasSideBar &&
273
260
  (headerType === 'default' || headerType === 'extended') &&
274
261
  !animatedHeader &&
275
262
  !inputSearchProps;
276
263
 
277
- // iPhone Duo: the header leaves with the content and returns on a reverse scroll
278
264
  const useQuickReturn =
279
265
  hasSideBar && scrollable && (useDuoGlass || !!animatedHeader);
280
266
  const headerHide = useSharedValue(0);
@@ -324,12 +310,14 @@ const Screen = forwardRef(
324
310
  */
325
311
  screen?.onSetParams?.(trackingParams);
326
312
 
313
+ const appliedHeaderMode = useRef<string | undefined>(undefined);
314
+
327
315
  /**
328
316
  * export options for screen
329
317
  * @param headerType
330
318
  */
331
319
  const setHeaderType = useCallback(
332
- (headerType: HeaderType) => {
320
+ (headerType: HeaderType, keepTitle = false) => {
333
321
  let options: StackNavigationOptions;
334
322
  switch (headerType) {
335
323
  case 'none':
@@ -418,6 +406,10 @@ const Screen = forwardRef(
418
406
  }
419
407
  }
420
408
 
409
+ if (keepTitle) {
410
+ delete options.headerTitle;
411
+ }
412
+
421
413
  navigation?.instance?.setOptions({ header: undefined, ...options });
422
414
  },
423
415
  [
@@ -449,10 +441,9 @@ const Screen = forwardRef(
449
441
  headerTransparent: true,
450
442
  headerBackground: (props: any) =>
451
443
  hasSideBar ? (
452
- // glass shows once the banner has scrolled under the header
453
444
  <DuoGlassBackground
454
445
  animatedValue={sharedValue}
455
- fadeStart={Math.max(210 + layoutOffset - heightHeader, 0)}
446
+ bannerBottom={ANIMATED_BANNER_HEIGHT + layoutOffset}
456
447
  />
457
448
  ) : (
458
449
  <HeaderBackground
@@ -486,7 +477,6 @@ const Screen = forwardRef(
486
477
  useShadowHeader,
487
478
  hasSideBar,
488
479
  layoutOffset,
489
- heightHeader,
490
480
  quickReturnOptions,
491
481
  ],
492
482
  );
@@ -521,7 +511,6 @@ const Screen = forwardRef(
521
511
  let searchWidth = layout.width - 24;
522
512
  let searchLeft = Spacing.M;
523
513
  if (layout.sideBar) {
524
- // back floats in the side bar: the search spans the content width
525
514
  searchWidth = layout.contentWidth - Spacing.M * 2;
526
515
  searchLeft = Spacing.M - getHeaderMargin(layout.width);
527
516
  }
@@ -563,10 +552,13 @@ const Screen = forwardRef(
563
552
 
564
553
  if (animatedHeader) {
565
554
  setAnimatedHeader(animatedHeader);
555
+ appliedHeaderMode.current = 'animated';
566
556
  } else if (inputSearchProps) {
567
557
  setAnimatedSearch();
558
+ appliedHeaderMode.current = 'search';
568
559
  } else {
569
- setHeaderType(headerType);
560
+ setHeaderType(headerType, appliedHeaderMode.current === headerType);
561
+ appliedHeaderMode.current = headerType;
570
562
  }
571
563
 
572
564
  return () => {
@@ -613,7 +605,6 @@ const Screen = forwardRef(
613
605
  useNativeDriver: true,
614
606
  listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
615
607
  const offsetY = e.nativeEvent.contentOffset.y;
616
- // keep the reanimated source in sync for the internal components.
617
608
  sharedValue.value = offsetY;
618
609
  scrollViewProps?.onScroll?.(e);
619
610
  if (animatedHeader) {
@@ -648,7 +639,6 @@ const Screen = forwardRef(
648
639
  */
649
640
  const snapQuickReturnHeader = (offsetY: number) => {
650
641
  const hide = headerHide.value;
651
- // above heightHeader the header still sits on the content
652
642
  if (
653
643
  !useQuickReturn ||
654
644
  offsetY < heightHeader ||
@@ -692,11 +682,12 @@ const Screen = forwardRef(
692
682
  if (typeof animatedHeader?.component === 'function') {
693
683
  return (
694
684
  <View
695
- style={[styles.screenBanner, { maxHeight: 210 + layoutOffset }]}
685
+ style={[
686
+ styles.screenBanner,
687
+ { maxHeight: ANIMATED_BANNER_HEIGHT + layoutOffset },
688
+ ]}
696
689
  >
697
690
  {animatedHeader?.component({
698
- // legacy consumers read `animatedValue` (Animated.Value),
699
- // modern consumers read `sharedValue` (SharedValue).
700
691
  animatedValue: animatedValue.current,
701
692
  sharedValue: sharedValue,
702
693
  })}
@@ -756,11 +747,6 @@ const Screen = forwardRef(
756
747
  }
757
748
  };
758
749
 
759
- // Cap the screen container height so a scrollable body with a sticky footer
760
- // can't push the footer past the visible frame (web previews measure the
761
- // safe-area frame from the seeded SafeAreaProvider metrics). Subtract the
762
- // bottom tab bar when present and the header unless it's an animated/extended
763
- // header (those overlay rather than offset the body).
764
750
  const getHeight = () => {
765
751
  let newHeight = frame.height;
766
752
  if (isTab) {
@@ -772,8 +758,6 @@ const Screen = forwardRef(
772
758
  return newHeight;
773
759
  };
774
760
 
775
- // without the grid, the content container keeps clear of the horizontal insets.
776
- // Only set when there are insets, so a caller's paddingHorizontal is never overridden.
777
761
  const hasContentInset = layout.insetLeft > 0 || layout.insetRight > 0;
778
762
  const needsContentInset = !useGridLayout && hasContentInset;
779
763
  const contentInsetStyle = needsContentInset && {
@@ -796,8 +780,6 @@ const Screen = forwardRef(
796
780
  Styles.flex,
797
781
  {
798
782
  backgroundColor: backgroundColor ?? theme.colors.background.default,
799
- // Web-only cap so a scrollable body with a sticky footer can't push
800
- // the footer past the frame. Native handles this without a cap.
801
783
  maxHeight: Platform.OS === 'web' ? getHeight() : undefined,
802
784
  },
803
785
  ]}
@@ -882,7 +864,6 @@ const Screen = forwardRef(
882
864
  )}
883
865
 
884
866
  {Footer && (
885
- // with side insets, the clip keeps the shadow off the side bar, only the top one shows
886
867
  <View
887
868
  pointerEvents={'box-none'}
888
869
  style={[
@@ -904,8 +885,6 @@ const Screen = forwardRef(
904
885
  },
905
886
  ]}
906
887
  >
907
- {/* The footer inset is a caller decision, not a platform one — a footer
908
- that carries its own horizontal padding passes `marginFooter={false}`. */}
909
888
  <Section useMargin={marginFooter}>{Footer}</Section>
910
889
  </View>
911
890
  </View>
package/Layout/utils.ts CHANGED
@@ -510,6 +510,7 @@ const useGridSystem = () => {
510
510
  export {
511
511
  DuoMetrics,
512
512
  HeaderMetrics,
513
+ InnerEdgeStyles,
513
514
  getHeaderMargin,
514
515
  getHeaderRowOptions,
515
516
  useGridSystem,
@@ -8,7 +8,7 @@ import { Image } from '../Image';
8
8
  import { Text, useScaleSize } from '../Text';
9
9
  import { PopupNotifyProps } from './types';
10
10
  import { scheduleOnRN } from 'react-native-worklets';
11
- import { usePopupMaxHeight, usePopupWidth } from './utils';
11
+ import { getPopupRadius, usePopupMaxHeight, usePopupWidth } from './utils';
12
12
 
13
13
  const PopupNotify: React.FC<PopupNotifyProps> = ({
14
14
  image,
@@ -26,6 +26,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
26
26
  const [scrollContent, setScrollContent] = useState(false);
27
27
  const popupWidth = usePopupWidth();
28
28
  const maxHeight = usePopupMaxHeight();
29
+ const radius = getPopupRadius();
29
30
  const scaledMaxHeight = useScaleSize(172);
30
31
 
31
32
  const showBaseLineDebug = context?.features?.showBaseLineDebug ?? false;
@@ -170,7 +171,15 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
170
171
 
171
172
  const body = (
172
173
  <>
173
- {!!image && <Image source={{ uri: image }} style={styles.image} />}
174
+ {!!image && (
175
+ <Image
176
+ source={{ uri: image }}
177
+ style={[
178
+ styles.image,
179
+ { borderTopLeftRadius: radius, borderTopRightRadius: radius },
180
+ ]}
181
+ />
182
+ )}
174
183
  <View style={styles.content}>
175
184
  <Text
176
185
  typography={'header_default_bold'}
@@ -218,9 +227,9 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
218
227
  <View
219
228
  accessibilityLabel={'popup_notify'}
220
229
  style={[
221
- styles.container,
222
230
  {
223
231
  backgroundColor: theme.colors.background.surface,
232
+ borderRadius: radius,
224
233
  width: popupWidth,
225
234
  maxHeight,
226
235
  },
@@ -231,7 +240,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
231
240
  body
232
241
  ) : (
233
242
  // scrolls when iPhone Duo landscape is too short; actions stay visible
234
- <ScrollView style={styles.body} bounces={false}>
243
+ <ScrollView
244
+ style={[
245
+ styles.body,
246
+ { borderTopLeftRadius: radius, borderTopRightRadius: radius },
247
+ ]}
248
+ bounces={false}
249
+ >
235
250
  {body}
236
251
  </ScrollView>
237
252
  )}
@@ -242,17 +257,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
242
257
  };
243
258
 
244
259
  const styles = StyleSheet.create({
245
- container: {
246
- borderRadius: Radius.L,
247
- },
248
260
  debugBaseLine: { borderWidth: 1, borderColor: Colors.green_06 },
249
261
  image: {
250
- borderTopLeftRadius: Radius.L,
251
- borderTopRightRadius: Radius.L,
252
262
  aspectRatio: 1.7777,
253
263
  overflow: 'hidden',
254
264
  },
255
- body: { flexShrink: 1 },
265
+ body: { flexShrink: 1, overflow: 'hidden' },
256
266
  content: { padding: Spacing.XL },
257
267
  description: {
258
268
  marginTop: Spacing.S,
package/Popup/utils.ts CHANGED
@@ -1,32 +1,26 @@
1
1
  import { Dimensions, useWindowDimensions } from 'react-native';
2
2
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
- import { Spacing } from '../Consts';
4
- import { getDuoTopInset, isIPhoneDuo } from '../Application/device';
5
-
6
- // width of a system alert on the iPhone Duo inner display, in both orientations
7
- const DUO_POPUP_MAX_WIDTH = 440;
3
+ import { Radius, Spacing } from '../Consts';
4
+ import { getDuoModalBounds, isIPhoneDuo } from '../Application/device';
8
5
 
9
6
  const usePopupWidth = () => {
10
- const windowSize = useWindowDimensions();
7
+ const insets = useSafeAreaInsets();
8
+ const { width, height } = useWindowDimensions();
11
9
  if (!isIPhoneDuo()) {
12
10
  return Dimensions.get('window').width - Spacing.XL * 2;
13
11
  }
14
- return Math.min(windowSize.width - Spacing.XL * 2, DUO_POPUP_MAX_WIDTH);
12
+ return getDuoModalBounds(insets, width, height).maxWidth;
15
13
  };
16
14
 
17
- // room left for a popup on iPhone Duo, where landscape is too short for it
18
15
  const usePopupMaxHeight = () => {
19
16
  const insets = useSafeAreaInsets();
20
17
  const { width, height } = useWindowDimensions();
21
18
  if (!isIPhoneDuo()) {
22
19
  return undefined;
23
20
  }
24
- return (
25
- height -
26
- getDuoTopInset(insets, width, height) -
27
- insets.bottom -
28
- Spacing.XL * 2
29
- );
21
+ return getDuoModalBounds(insets, width, height).maxHeight;
30
22
  };
31
23
 
32
- export { usePopupWidth, usePopupMaxHeight };
24
+ const getPopupRadius = () => (isIPhoneDuo() ? Radius.XL : Radius.L);
25
+
26
+ export { usePopupWidth, usePopupMaxHeight, getPopupRadius };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.168.1-beta.4",
3
+ "version": "0.168.1-beta.40",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},
@@ -8,21 +8,21 @@
8
8
  "@momo-kits/foundation"
9
9
  ],
10
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",
12
11
  "@react-navigation/bottom-tabs": "7.4.2",
13
12
  "@react-navigation/core": "7.12.1",
14
13
  "@react-navigation/elements": "2.5.2",
15
14
  "@react-navigation/native": "7.1.14",
16
15
  "@react-navigation/routers": "7.4.1",
17
16
  "@react-navigation/stack": "7.4.2",
17
+ "@shopify/flash-list": "2.1.0",
18
+ "lottie-react-native": "7.2.4",
19
+ "react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
18
20
  "react-native-gesture-handler": "2.27.1",
19
21
  "react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
20
22
  "react-native-reanimated": "4.2.2",
21
- "react-native-worklets": "0.6.1",
22
- "react-native-safe-area-context": "5.5.2",
23
23
  "react-native-reserved-regions": "0.2.0",
24
- "@shopify/flash-list": "2.1.0",
25
- "lottie-react-native": "7.2.4"
24
+ "react-native-safe-area-context": "5.5.2",
25
+ "react-native-worklets": "0.6.1"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react-native": "*",
@@ -35,4 +35,4 @@
35
35
  "registry": "https://registry.npmjs.org/"
36
36
  },
37
37
  "license": "MoMo"
38
- }
38
+ }