@momo-kits/foundation 0.169.19-beta.1 → 0.169.19-beta.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.
Files changed (44) hide show
  1. package/Application/BottomSheet.parts.tsx +4 -4
  2. package/Application/BottomSheet.tsx +18 -8
  3. package/Application/BottomTab/BottomTabBar.styles.ts +1 -1
  4. package/Application/BottomTab/DuoTabBar.styles.ts +1 -1
  5. package/Application/BottomTab/TabBarIcon.tsx +1 -1
  6. package/Application/Components/HeaderExtendHeader.tsx +2 -7
  7. package/Application/Components/HeaderLeft.tsx +5 -9
  8. package/Application/Components/HeaderRight.styles.ts +1 -5
  9. package/Application/Components/HeaderRight.tsx +21 -7
  10. package/Application/Components/SearchHeader.tsx +1 -5
  11. package/Application/Components/useHeaderRightWidth.ts +2 -2
  12. package/Application/ModalIconButton.tsx +15 -13
  13. package/Application/ModalScreen.tsx +6 -15
  14. package/Application/StackScreen.tsx +2 -6
  15. package/Application/TooltipPortal.tsx +3 -3
  16. package/Application/__tests__/headerLayout.test.ts +1 -2
  17. package/Application/headerLayout.ts +13 -10
  18. package/Application/hooks.ts +1 -1
  19. package/Application/modalLayout.ts +3 -43
  20. package/Application/navigationOptions.tsx +12 -5
  21. package/Button/index.tsx +2 -2
  22. package/Divider/DashDivider.tsx +2 -2
  23. package/Divider/index.tsx +3 -3
  24. package/FoundationList/index.tsx +1 -1
  25. package/Icon/types.ts +2 -1
  26. package/Image/index.tsx +7 -62
  27. package/Image/styles.ts +0 -2
  28. package/Image/types.ts +1 -9
  29. package/Input/ErrorView.tsx +1 -1
  30. package/Input/Input.tsx +2 -2
  31. package/Input/InputMoney.tsx +2 -7
  32. package/Input/InputMoneyView.tsx +16 -8
  33. package/Input/InputOTP.tsx +2 -2
  34. package/Input/InputPhoneNumber.tsx +40 -22
  35. package/Input/InputSearch.tsx +2 -2
  36. package/Input/InputTextArea.tsx +2 -2
  37. package/Input/SearchTextTyping.tsx +2 -2
  38. package/Input/SystemTextInput.tsx +1 -2
  39. package/Input/TextTyping.tsx +2 -7
  40. package/Input/index.tsx +1 -15
  41. package/Layout/screenHeader.tsx +20 -16
  42. package/Pagination/types.ts +2 -6
  43. package/package.json +26 -28
  44. package/Input/CountryCodeView.tsx +0 -109
@@ -1,11 +1,6 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  import React, { FC, memo, useEffect, useRef } from 'react';
3
- import {
4
- Platform,
5
- TextInput,
6
- TextStyle,
7
- type TextInputInstance,
8
- } from 'react-native';
3
+ import { Platform, TextInput, TextStyle } from 'react-native';
9
4
  import { Colors } from '../Consts';
10
5
  import { useScaleSize, exportFontFamily } from '../Text';
11
6
 
@@ -26,7 +21,7 @@ const TextTyping: FC<TextTypingProps> = ({
26
21
  timeDelayNextChar = 20,
27
22
  inputStyle = {},
28
23
  }) => {
29
- const textRef = useRef<TextInputInstance>(null);
24
+ const textRef = useRef<TextInput>(null);
30
25
  const scaledFontSize = useScaleSize(12);
31
26
  const inputFontFamily = exportFontFamily('regular');
32
27
 
package/Input/index.tsx CHANGED
@@ -351,23 +351,9 @@ export interface InputDropDownProps extends TouchableOpacityProps {
351
351
 
352
352
  export interface InputPhoneNumberProps extends InputProps {
353
353
  /**
354
- * Optional. Dial code shown verbatim before the number.
355
- * Defaults to `+84` if not provided.
354
+ * Optional. Currently unused: the displayed prefix is always `+84`.
356
355
  */
357
356
  countryCode?: string;
358
-
359
- /**
360
- * Optional. URL of the flag image shown before the dial code.
361
- * Defaults to the Vietnam flag if not provided.
362
- */
363
- countryFlag?: string;
364
-
365
- /**
366
- * Optional. Called when the flag or dial code is pressed (e.g. to pick a country),
367
- * which then reads as a button with a chevron after the code. Ignored while
368
- * `disabled` or `editable={false}`.
369
- */
370
- onPressLeadingIcon?: () => void;
371
357
  }
372
358
 
373
359
  export type InputRef = {
@@ -13,8 +13,11 @@ import {
13
13
  SearchHeader,
14
14
  } from '../Application';
15
15
  import { DuoGlassBackground } from '../Application/Components/DuoGlassBackground';
16
- import { type HeaderContentLayout } from '../Application/headerLayout';
17
- import { getHeaderMargin } from './utils';
16
+ import {
17
+ getHeaderRowInset,
18
+ type HeaderContentLayout,
19
+ TITLE_CONTAINER_RESET,
20
+ } from '../Application/headerLayout';
18
21
  import { useHeaderBarOptions } from './useHeaderBarOptions';
19
22
  import { HeaderType } from './types';
20
23
 
@@ -242,10 +245,11 @@ export const useScreenHeader = ({
242
245
  // the search field spans the content, clear of the side bar and status bar
243
246
  // clusters; kept as numbers so the setter below stays stable
244
247
  let searchWidth = layout.width - Spacing.M * 2;
245
- let searchLeft = Spacing.M;
248
+ // past back, or at the row start when back is hidden or floats in the side bar
249
+ const rowStartLeft = getHeaderRowInset(layout.width);
250
+ const searchLeft = layout.sideBar ? rowStartLeft : Spacing.M;
246
251
  if (layout.sideBar) {
247
252
  searchWidth = layout.contentWidth - Spacing.M * 2;
248
- searchLeft = Spacing.M - getHeaderMargin(layout.width);
249
253
  }
250
254
  const clearance = layout.statusBarClearance;
251
255
  if (clearance) {
@@ -259,25 +263,18 @@ export const useScreenHeader = ({
259
263
  const setSearchHeader = useCallback(
260
264
  (params: SearchHeaderProps) => {
261
265
  searchHeaderParams.current = params;
266
+ const hasBack = !params?.hiddenBack;
262
267
  const options: StackNavigationOptions = {
263
268
  ...searchOptions,
264
269
  headerRight: undefined,
265
270
  headerTitleContainerStyle: {
271
+ ...TITLE_CONTAINER_RESET,
266
272
  width: searchWidth,
267
273
  maxWidth: searchWidth,
268
- marginLeft: 0,
269
- marginEnd: 0,
270
- marginStart: 0,
271
- marginHorizontal: 0,
272
- marginVertical: 0,
273
- margin: 0,
274
- left: searchLeft,
274
+ left: hasBack ? searchLeft : rowStartLeft,
275
275
  },
276
276
  headerLeft: (props: any) => {
277
- if (params?.hiddenBack) {
278
- return null;
279
- }
280
- return <HeaderLeft {...props} floating />;
277
+ return hasBack && <HeaderLeft {...props} floating />;
281
278
  },
282
279
  headerTitle: () => (
283
280
  <SearchHeader {...params} animatedValue={sharedValue} />
@@ -286,7 +283,14 @@ export const useScreenHeader = ({
286
283
 
287
284
  navigation?.instance?.setOptions(options);
288
285
  },
289
- [navigation?.instance, sharedValue, searchOptions, searchWidth, searchLeft],
286
+ [
287
+ navigation?.instance,
288
+ sharedValue,
289
+ searchOptions,
290
+ searchWidth,
291
+ searchLeft,
292
+ rowStartLeft,
293
+ ],
290
294
  );
291
295
 
292
296
  useEffect(() => {
@@ -1,8 +1,4 @@
1
- import {
2
- ScrollViewProps,
3
- ViewStyle,
4
- type ScrollViewInstance,
5
- } from 'react-native';
1
+ import {ScrollView, ScrollViewProps, ViewStyle} from 'react-native';
6
2
  import {Ref} from 'react';
7
3
 
8
4
  export type PaginationProps = {
@@ -36,7 +32,7 @@ export interface ScrollIndicatorProps extends ScrollViewProps {
36
32
  * Optional. Represents a reference to the ScrollView component.
37
33
  * It can be used to access the instance methods of the ScrollView.
38
34
  */
39
- scrollViewRef?: Ref<ScrollViewInstance>;
35
+ scrollViewRef?: Ref<ScrollView>;
40
36
  }
41
37
 
42
38
  export type ChildPaginationProps = Omit<PaginationProps, 'type'>;
package/package.json CHANGED
@@ -1,41 +1,39 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.19-beta.1",
3
+ "version": "0.169.19-beta.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": {
15
- "@react-navigation/bottom-tabs": "7.21.0",
16
- "@react-navigation/core": "7.24.0",
17
- "@react-navigation/elements": "2.9.45",
18
- "@react-navigation/native": "7.5.1",
19
- "@react-navigation/routers": "7.6.5",
20
- "@react-navigation/stack": "7.12.1",
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
+ "@react-navigation/bottom-tabs": "7.4.2",
13
+ "@react-navigation/core": "7.12.1",
14
+ "@react-navigation/elements": "2.5.2",
15
+ "@react-navigation/native": "7.1.14",
16
+ "@react-navigation/routers": "7.4.1",
17
+ "@react-navigation/stack": "7.4.2",
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.1.3",
21
+ "react-native-worklets": "0.6.1",
22
+ "react-native-safe-area-context": "5.5.2",
23
+ "react-native-reserved-regions": "0.2.0",
21
24
  "@shopify/flash-list": "2.1.0",
22
- "lottie-react-native": "7.3.6",
23
- "react-native-fast-image": "git+https://oauth2:k_r5y_gV6sX9-TqQxgcd@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
24
- "react-native-gesture-handler": "3.4.0",
25
- "react-native-linear-gradient": "git+https://oauth2:k_r5y_gV6sX9-TqQxgcd@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
26
- "react-native-reanimated": "4.7.1",
27
- "react-native-safe-area-context": "5.7.0",
28
- "react-native-reserved-regions": "0.2.0"
29
- },
30
- "devDependencies": {
31
- "@types/color": "3.0.6",
32
- "react-native-reanimated": "4.7.1",
33
- "react-native-worklets": "0.13.0"
25
+ "lottie-react-native": "7.2.4"
34
26
  },
35
27
  "peerDependencies": {
36
28
  "react-native": "*",
37
29
  "react-native-svg": "*",
38
- "react-native-reanimated": ">=4.7.0",
39
- "react-native-worklets": ">=0.13.0"
40
- }
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"
41
39
  }
@@ -1,109 +0,0 @@
1
- import React from 'react';
2
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
3
- import { Colors, Spacing, Styles } from '../Consts';
4
- import { Icon } from '../Icon';
5
- import { Image } from '../Image';
6
- import { Text } from '../Text';
7
- import { Typography } from '../Text/types';
8
- import styles from './styles';
9
-
10
- const FLAG_SIZE = 24;
11
- const CHEVRON_SIZE = 16;
12
-
13
- type CountryCodeViewProps = {
14
- countryCode: string;
15
- countryFlag: string;
16
- typography: Typography;
17
- textColor: string;
18
- dividerHeight: number;
19
- componentId: string;
20
- isDisabled: boolean;
21
- onPress?: () => void;
22
- };
23
-
24
- /**
25
- * Flag, dial code and divider ahead of a phone number. Only becomes a button,
26
- * with a chevron after the code, when `onPress` is given, so the default
27
- * render stays a plain view.
28
- */
29
- const CountryCodeView: React.FC<CountryCodeViewProps> = ({
30
- countryCode,
31
- countryFlag,
32
- typography,
33
- textColor,
34
- dividerHeight,
35
- componentId,
36
- isDisabled,
37
- onPress,
38
- }) => {
39
- const content = (
40
- <>
41
- <Image
42
- source={{ uri: countryFlag }}
43
- style={innerStyle.iconFlag}
44
- resizeMode="contain"
45
- accessibilityLabel={`${componentId}|leading-icon`}
46
- />
47
- <View style={{ width: Spacing.XS }} />
48
- <Text typography={typography} color={textColor}>
49
- {countryCode}
50
- </Text>
51
- {/* Kept while disabled (greyed by textColor) so the layout doesn't shift. */}
52
- {onPress && (
53
- <Icon
54
- source="arrow_chevron_down_small"
55
- size={CHEVRON_SIZE}
56
- color={textColor}
57
- style={innerStyle.chevron}
58
- accessibilityLabel={`${componentId}|leading-chevron`}
59
- />
60
- )}
61
- </>
62
- );
63
-
64
- const renderContent = () => {
65
- if (!onPress) {
66
- return content;
67
- }
68
- return (
69
- <TouchableOpacity
70
- style={Styles.row}
71
- onPress={onPress}
72
- disabled={isDisabled}
73
- accessibilityRole="button"
74
- accessibilityLabel={`${componentId}|leading-icon-touch|${countryCode}`}
75
- accessibilityState={{ disabled: isDisabled }}
76
- >
77
- {content}
78
- </TouchableOpacity>
79
- );
80
- };
81
-
82
- return (
83
- <View style={[styles.leadingIconContainer, Styles.row]}>
84
- {renderContent()}
85
- <View
86
- style={[
87
- styles.phoneNumberDivider,
88
- {
89
- height: dividerHeight,
90
- backgroundColor: Colors.black_04,
91
- },
92
- ]}
93
- />
94
- </View>
95
- );
96
- };
97
-
98
- const innerStyle = StyleSheet.create({
99
- iconFlag: {
100
- width: FLAG_SIZE,
101
- height: FLAG_SIZE,
102
- marginHorizontal: Spacing.XXS,
103
- },
104
- chevron: {
105
- marginLeft: Spacing.XS,
106
- },
107
- });
108
-
109
- export { CountryCodeView };