@momo-kits/foundation 0.92.1-tracking.1 → 0.92.1-tracking.13

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.
@@ -58,7 +58,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
58
58
  });
59
59
  }, []);
60
60
 
61
- const accessibilityID = getAccessibilityID("tbr_main_bottom")
61
+ const accessibilityID = getAccessibilityID?.("tbr_main_bottom")
62
62
 
63
63
  return (
64
64
  <Tab.Navigator
@@ -75,7 +75,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
75
75
  },
76
76
  }}>
77
77
  {tabs.map(item => {
78
- const itemAccessibilityID = getAccessibilityID(`btn_tabbar_${item.name}`)
78
+ const itemAccessibilityID = getAccessibilityID?.(`btn_tabbar_${item.name}`)
79
79
  return (
80
80
  <Tab.Screen
81
81
  {...itemAccessibilityID}
@@ -29,7 +29,7 @@ import {scaleSize, Text} from '../Text';
29
29
  import {Icon} from '../Icon';
30
30
  import {PopupNotify} from '../Popup';
31
31
  import {Badge, BadgeDot} from '../Badge';
32
- import {getAccessibilityID} from "./utils";
32
+ import {getAccessibilityID} from './utils';
33
33
 
34
34
  const NavigationButton: React.FC<NavigationButtonProps> = ({
35
35
  icon,
@@ -38,7 +38,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
38
38
  useBorder = true,
39
39
  badgeType,
40
40
  badgeValue,
41
- accessibilityID = ''
41
+ accessibilityID = '',
42
42
  }) => {
43
43
  const {theme} = useContext(ApplicationContext);
44
44
  let buttonStyle: ViewStyle = {backgroundColor: '#00000066'};
@@ -65,7 +65,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
65
65
  }
66
66
  }, [badgeType, badgeValue]);
67
67
 
68
- const ID = getAccessibilityID(accessibilityID)
68
+ const ID = getAccessibilityID?.(accessibilityID);
69
69
  return (
70
70
  <View {...ID} style={{width: scaleSize(28)}}>
71
71
  <TouchableOpacity
@@ -93,6 +93,7 @@ const HeaderTitle: React.FC<any> = props => {
93
93
  return (
94
94
  <Animated.Text
95
95
  {...props}
96
+ accessibilityLabel={getAccessibilityID('title_navigation_header')}
96
97
  style={[
97
98
  styles.title,
98
99
  {fontFamily: `${theme.font}-Bold`, opacity, color: props.tintColor},
@@ -170,9 +171,9 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
170
171
  return true;
171
172
  };
172
173
  return (
173
- <View style={styles.headerLeft}>
174
+ <View style={styles.headerLeft}>
174
175
  <NavigationButton
175
- accessibilityID = "btn_navigation_back"
176
+ accessibilityID="btn_navigation_back"
176
177
  icon="ic_back"
177
178
  tintColor={tintColor}
178
179
  onPress={goBackSafe}
@@ -246,7 +247,10 @@ const HeaderCustom: React.FC<TitleCustomProps> = ({
246
247
  )}
247
248
  </View>
248
249
  <View style={[Styles.flex, {paddingHorizontal: 8}]}>
249
- <Text typography="header_default_bold" color={tintColor}>
250
+ <Text
251
+ {...getAccessibilityID('title_navigation_header')}
252
+ typography="header_default_bold"
253
+ color={tintColor}>
250
254
  {title}
251
255
  </Text>
252
256
  <Text typography="description_default_regular" color={tintColor}>
@@ -293,7 +297,7 @@ const HeaderToolkitAction: React.FC<any> = ({
293
297
  tintColor,
294
298
  pinnedTool,
295
299
  runtimeTools = [],
296
- preventBack,
300
+ preventClose,
297
301
  }) => {
298
302
  const {theme, navigator} = useContext(ApplicationContext);
299
303
  const miniContext = useContext(MiniAppContext);
@@ -340,15 +344,15 @@ const HeaderToolkitAction: React.FC<any> = ({
340
344
  };
341
345
 
342
346
  const onClose = () => {
343
- if (preventBack) {
347
+ if (preventClose) {
344
348
  navigator?.showModal({
345
349
  screen: () => (
346
350
  <PopupNotify
347
- {...preventBack}
351
+ {...preventClose}
348
352
  primary={{
349
- title: preventBack.primary.title,
353
+ title: preventClose.primary.title,
350
354
  onPress: () => {
351
- preventBack?.primary.onPress();
355
+ preventClose?.primary.onPress();
352
356
  navigator?.maxApi?.dispatchFunction?.(
353
357
  'dismiss',
354
358
  undefined,
@@ -372,7 +376,7 @@ const HeaderToolkitAction: React.FC<any> = ({
372
376
  if (pinTool)
373
377
  return (
374
378
  <NavigationButton
375
- accessibilityID = "btn_navigation_pin"
379
+ accessibilityID="btn_navigation_pin"
376
380
  icon={pinTool.icon as string}
377
381
  tintColor={tintColor}
378
382
  badgeValue={badgeValue}
@@ -403,14 +407,14 @@ const HeaderToolkitAction: React.FC<any> = ({
403
407
  },
404
408
  ]}>
405
409
  <TouchableOpacity
406
- {...getAccessibilityID("btn_navigation_more")}
407
- onPress={onMore}>
410
+ {...getAccessibilityID?.('btn_navigation_more')}
411
+ onPress={onMore}>
408
412
  <Icon color={tintColor} source="navigation_more_horiz" size={20} />
409
413
  </TouchableOpacity>
410
414
  <View style={[styles.divider, {backgroundColor: tintColor}]} />
411
415
  <TouchableOpacity
412
- {...getAccessibilityID("btn_navigation_close")}
413
- onPress={onClose}>
416
+ {...getAccessibilityID?.('btn_navigation_close')}
417
+ onPress={onClose}>
414
418
  <Icon
415
419
  color={tintColor}
416
420
  source="16_navigation_close_circle"
@@ -428,7 +432,7 @@ const HeaderToolkitAction: React.FC<any> = ({
428
432
  const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
429
433
  animatedValue,
430
434
  image,
431
- onPress,
435
+ children,
432
436
  }) => {
433
437
  const scale = animatedValue.interpolate({
434
438
  inputRange: [-300, 0, 300],
@@ -447,21 +451,21 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
447
451
  });
448
452
 
449
453
  return (
450
- <TouchableOpacity onPress={onPress}>
451
- <Animated.View
452
- style={{
453
- height: 210,
454
- opacity: opacity,
455
- transform: [{scale}, {translateY}],
456
- }}>
454
+ <Animated.View
455
+ style={{
456
+ height: 210,
457
+ opacity: opacity,
458
+ transform: [{scale}, {translateY}],
459
+ }}>
460
+ {children ?? (
457
461
  <Image
458
462
  source={{
459
463
  uri: image,
460
464
  }}
461
465
  style={{width: '100%', height: '100%'}}
462
466
  />
463
- </Animated.View>
464
- </TouchableOpacity>
467
+ )}
468
+ </Animated.View>
465
469
  );
466
470
  };
467
471
 
@@ -1,29 +1,21 @@
1
- import React, {useContext, useEffect, useMemo, useRef, useState} from 'react';
1
+ import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {
3
- Dimensions,
4
- Keyboard,
5
3
  KeyboardAvoidingView,
6
4
  Platform,
7
5
  Pressable,
8
6
  StyleSheet,
7
+ TouchableOpacity,
9
8
  View,
10
9
  } from 'react-native';
10
+ import {Modalize} from 'react-native-modalize';
11
11
  import {SafeAreaView, useSafeAreaInsets} from 'react-native-safe-area-context';
12
- import {
13
- BottomSheetBackdrop,
14
- BottomSheetModal,
15
- BottomSheetView,
16
- } from '@gorhom/bottom-sheet';
12
+
13
+ import {ApplicationContext} from '.';
14
+ import {Radius, Spacing, Styles} from '../Consts';
15
+ import {Icon} from '../Icon';
16
+ import {Text} from '../Text';
17
17
  import Navigation from './Navigation';
18
18
  import {BottomSheetParams, ModalParams} from './types';
19
- import {Radius, Spacing, Styles} from '../Consts';
20
- import {
21
- ApplicationContext,
22
- HeaderRightAction,
23
- NavigationButton,
24
- NavigationContainer,
25
- } from './index';
26
- import {HeaderBackground, HeaderLeft, HeaderTitle} from './Components';
27
19
 
28
20
  const ModalScreen: React.FC<any> = props => {
29
21
  /**
@@ -92,141 +84,88 @@ const Modal: React.FC<ModalParams> = props => {
92
84
  };
93
85
 
94
86
  const BottomSheet: React.FC<BottomSheetParams> = props => {
95
- const insets = useSafeAreaInsets();
96
87
  const {theme, navigator} = useContext(ApplicationContext);
97
- const [keyboardSnap, setKeyboardSnap] = useState(0);
98
- const {screen, options, snapPoint, indicatorColor}: BottomSheetParams =
99
- props.route.params;
100
- const Component = useRef(screen).current;
88
+ const {
89
+ screen: Screen,
90
+ options,
91
+ footerComponent,
92
+ flatListProps,
93
+ }: BottomSheetParams = props.route.params;
94
+
101
95
  const navigation = new Navigation(props.navigation, theme);
96
+
102
97
  const params = {
103
98
  ...props.route.params,
104
99
  navigation,
105
100
  };
106
101
 
107
102
  delete params.screen;
108
-
109
- const snapPoints = useMemo(() => {
110
- if (snapPoint) {
111
- const current = parseInt(snapPoint) + keyboardSnap * 100;
112
- return [`${current}%`];
113
- }
114
- return ['50%', '70%', '90%'];
115
- }, [keyboardSnap]);
116
-
117
- const bottomSheetRef = useRef<any>(null);
118
- const mountedRef = useRef(true);
119
-
120
- let backgroundColor = theme.colors.background.default;
121
- let bottomInset = keyboardSnap * Dimensions.get('window').height;
122
- if (bottomInset > 16) {
123
- bottomInset -= 16;
124
- }
125
- if (options?.surface) {
126
- backgroundColor = theme.colors.background.surface;
127
- }
103
+ const modalizeRef = useRef<Modalize>(null);
128
104
 
129
105
  useEffect(() => {
130
- const keyboardDidShow = Keyboard.addListener('keyboardDidShow', e => {
131
- setKeyboardSnap(
132
- e.endCoordinates.height / Dimensions.get('window').height,
133
- );
134
- bottomSheetRef.current?.expand();
135
- });
136
-
137
- const keyboardDidHide = Keyboard.addListener('keyboardDidHide', () => {
138
- setKeyboardSnap(0);
139
- });
140
-
141
- bottomSheetRef.current?.present();
142
- return () => {
143
- mountedRef.current = false;
144
- keyboardDidShow.remove();
145
- keyboardDidHide.remove();
146
- };
106
+ modalizeRef.current?.open();
147
107
  }, []);
148
108
 
149
- const backdropComponent = (backdropProps: any) => (
150
- <BottomSheetBackdrop
151
- disappearsOnIndex={-1}
152
- appearsOnIndex={0}
153
- {...backdropProps}
154
- />
155
- );
109
+ const handleClose = () => {
110
+ modalizeRef?.current?.close();
111
+ };
156
112
 
157
113
  return (
158
114
  <SafeAreaView style={Styles.flex}>
159
- <BottomSheetModal
160
- ref={bottomSheetRef}
161
- snapPoints={snapPoints}
162
- onDismiss={() => {
163
- if (mountedRef.current) {
164
- navigator?.pop();
165
- }
115
+ <Modalize
116
+ keyboardAvoidingOffset={-20}
117
+ adjustToContentHeight
118
+ closeOnOverlayTap
119
+ closeSnapPointStraightEnabled
120
+ onClosed={() => {
121
+ navigator?.pop();
166
122
  }}
167
- bottomInset={Platform.OS === 'ios' ? bottomInset : 0}
168
- handleComponent={null}
169
- backdropComponent={backdropComponent}>
170
- <BottomSheetView>
171
- <View style={[styles.sheetContainer, {backgroundColor}]}>
172
- <View style={styles.indicatorContainer}>
173
- <View
174
- style={[
175
- styles.indicator,
176
- {backgroundColor: theme.colors.text.disable},
177
- ]}
178
- />
179
- </View>
180
- <NavigationContainer
181
- maxApi={navigator?.maxApi}
182
- theme={{
183
- ...theme,
184
- assets: {...theme.assets, headerBackground: undefined},
185
- }}
186
- screen={props => <Component {...props} {...params} />}
187
- options={{
188
- ...options,
189
- ...{
190
- headerLeft: (props: any) => {
191
- if (props.canGoBack) {
192
- return <HeaderLeft {...props} useBorder={false} />;
193
- }
194
- },
195
- headerTitle: (props: any) => {
196
- return <HeaderTitle {...props} />;
197
- },
198
- headerTintColor: theme.colors.text.default,
199
- headerBackground: () => (
200
- <HeaderBackground backgroundColor={backgroundColor} />
201
- ),
202
- headerTransparent: false,
203
- },
204
- headerTitleAlign: 'center',
205
- headerRight: props => (
206
- <HeaderRightAction>
207
- <NavigationButton
208
- {...props}
209
- icon="24_navigation_close"
210
- useBorder={false}
211
- onPress={() => bottomSheetRef.current?.dismiss()}
212
- />
213
- </HeaderRightAction>
214
- ),
215
- }}
216
- />
217
- <View
218
- style={{
219
- height: Math.min(insets.bottom, 20),
220
- backgroundColor: indicatorColor ?? backgroundColor,
221
- }}
222
- />
223
- </View>
224
- </BottomSheetView>
225
- </BottomSheetModal>
123
+ ref={modalizeRef}
124
+ withHandle={false}
125
+ flatListProps={flatListProps}
126
+ HeaderComponent={headerDefault(
127
+ options?.title ?? options?.customTitle?.title ?? '',
128
+ handleClose,
129
+ )}
130
+ FooterComponent={footerDefault(footerComponent)}>
131
+ <View style={styles.bottomSheetContainer}>
132
+ <Screen {...props} {...params} />
133
+ </View>
134
+ </Modalize>
226
135
  </SafeAreaView>
227
136
  );
228
137
  };
229
138
 
139
+ const headerDefault = (title: string, onClose: () => void) => {
140
+ return (
141
+ <View style={styles.header}>
142
+ <Text
143
+ style={styles.textOption}
144
+ numberOfLines={2}
145
+ typography="header_default_bold">
146
+ {title ?? ''}
147
+ </Text>
148
+ <TouchableOpacity style={styles.buttonClose} onPress={onClose}>
149
+ <Icon source="navigation_close" />
150
+ </TouchableOpacity>
151
+ </View>
152
+ );
153
+ };
154
+
155
+ const footerDefault = (footerComponent: React.ReactNode) => {
156
+ const insets = useSafeAreaInsets();
157
+ if (!footerComponent) return;
158
+ return (
159
+ <View
160
+ style={{
161
+ marginBottom: Math.min(insets.bottom, 21) + Spacing.S,
162
+ paddingHorizontal: 12,
163
+ }}>
164
+ {footerComponent}
165
+ </View>
166
+ );
167
+ };
168
+
230
169
  const styles = StyleSheet.create({
231
170
  container: {flex: 1, flexDirection: 'row'},
232
171
  modalContent: {
@@ -263,6 +202,43 @@ const styles = StyleSheet.create({
263
202
  height: 4,
264
203
  borderRadius: Radius.S,
265
204
  },
205
+ bottomSheetContainer: {
206
+ width: '100%',
207
+ backgroundColor: 'white',
208
+ borderTopRightRadius: 16,
209
+ borderTopLeftRadius: 16,
210
+ },
211
+ header: {
212
+ height: 50,
213
+ width: '100%',
214
+ alignItems: 'center',
215
+ justifyContent: 'center',
216
+ },
217
+ textOption: {
218
+ fontSize: 16,
219
+ color: '#303233',
220
+ textAlign: 'center',
221
+ fontWeight: 'bold',
222
+ paddingHorizontal: 60,
223
+ },
224
+ imageOption: {
225
+ height: 1,
226
+ backgroundColor: '#ebebeb',
227
+ width: '100%',
228
+ position: 'absolute',
229
+ bottom: 1,
230
+ },
231
+ buttonClose: {
232
+ padding: 12,
233
+ position: 'absolute',
234
+ right: 0,
235
+ },
236
+ icon: {
237
+ width: 24,
238
+ height: 24,
239
+ tintColor: '#303233',
240
+ backgroundColor: 'red',
241
+ },
266
242
  });
267
243
 
268
244
  export default ModalScreen;
@@ -1,5 +1,4 @@
1
1
  import React, {useContext, useEffect, useRef, useState} from 'react';
2
- import {BottomSheetModalProvider} from '@gorhom/bottom-sheet';
3
2
  import {SafeAreaProvider} from 'react-native-safe-area-context';
4
3
  import {
5
4
  NavigationContainer as ReactNavigationContainer,
@@ -23,7 +22,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
23
22
  options,
24
23
  maxApi,
25
24
  localization,
26
- params,
25
+ initialParams,
27
26
  }) => {
28
27
  const context = useContext(MiniAppContext);
29
28
  const navigationRef = useRef<NavigationContainerRef>(null);
@@ -69,55 +68,53 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
69
68
 
70
69
  return (
71
70
  <SafeAreaProvider>
72
- <BottomSheetModalProvider>
73
- <ApplicationContext.Provider
74
- value={{
75
- navigator: navigator.current,
76
- config: config.current,
77
- theme,
78
- showGrid,
79
- translate,
80
- }}>
81
- <ReactNavigationContainer
82
- theme={{
83
- ...theme,
84
- colors: {
85
- ...theme.colors,
86
- background: theme.colors.background.default,
87
- card: theme.colors.background.surface,
88
- text: theme.colors.text.default,
89
- border: theme.colors.border.default,
90
- notification: theme.colors.error.primary,
91
- },
92
- }}
93
- ref={navigator.current?.ref}
94
- onReady={() => {
95
- isReady.current = true;
96
- }}
97
- independent={true}>
98
- <Stack.Navigator initialRouteName="Stack" headerMode="screen">
99
- <Stack.Screen
100
- name="Stack"
101
- component={StackScreen}
102
- initialParams={{screen, params}}
103
- options={{...getStackOptions(), ...options}}
104
- />
105
- <Stack.Screen
106
- name="Dialog"
107
- component={StackScreen}
108
- options={getDialogOptions()}
109
- initialParams={{screen}}
110
- />
111
- <Stack.Screen
112
- name="Modal"
113
- component={ModalScreen}
114
- options={getModalOptions()}
115
- initialParams={{screen}}
116
- />
117
- </Stack.Navigator>
118
- </ReactNavigationContainer>
119
- </ApplicationContext.Provider>
120
- </BottomSheetModalProvider>
71
+ <ApplicationContext.Provider
72
+ value={{
73
+ navigator: navigator.current,
74
+ config: config.current,
75
+ theme,
76
+ showGrid,
77
+ translate,
78
+ }}>
79
+ <ReactNavigationContainer
80
+ theme={{
81
+ ...theme,
82
+ colors: {
83
+ ...theme.colors,
84
+ background: theme.colors.background.default,
85
+ card: theme.colors.background.surface,
86
+ text: theme.colors.text.default,
87
+ border: theme.colors.border.default,
88
+ notification: theme.colors.error.primary,
89
+ },
90
+ }}
91
+ ref={navigator.current?.ref}
92
+ onReady={() => {
93
+ isReady.current = true;
94
+ }}
95
+ independent={true}>
96
+ <Stack.Navigator initialRouteName="Stack" headerMode="screen">
97
+ <Stack.Screen
98
+ name="Stack"
99
+ component={StackScreen}
100
+ initialParams={{screen, initialParams}}
101
+ options={{...getStackOptions(), ...options}}
102
+ />
103
+ <Stack.Screen
104
+ name="Dialog"
105
+ component={StackScreen}
106
+ options={getDialogOptions()}
107
+ initialParams={{screen}}
108
+ />
109
+ <Stack.Screen
110
+ name="Modal"
111
+ component={ModalScreen}
112
+ options={getModalOptions()}
113
+ initialParams={{screen}}
114
+ />
115
+ </Stack.Navigator>
116
+ </ReactNavigationContainer>
117
+ </ApplicationContext.Provider>
121
118
  </SafeAreaProvider>
122
119
  );
123
120
  };
@@ -19,23 +19,27 @@ const StackScreen: React.FC<ScreenParams> = props => {
19
19
 
20
20
  const context = useContext(MiniAppContext);
21
21
 
22
- const {screen: Component, options, params}: ScreenParams = props.route.params;
22
+ const {
23
+ screen: Component,
24
+ options,
25
+ initialParams,
26
+ }: ScreenParams = props.route.params;
23
27
  const navigation = new Navigation(props.navigation, theme);
24
28
  const heightHeader = useHeaderHeight();
25
29
 
26
30
  const data = {
27
31
  ...props.route.params,
28
- params,
32
+ ...initialParams,
29
33
  navigation,
30
34
  };
31
35
 
32
36
  delete data.screen;
37
+ delete data.initialParams;
33
38
 
34
39
  /**
35
40
  * set options for screen
36
41
  */
37
42
  useLayoutEffect(() => {
38
- startTime.current = Date.now();
39
43
  InteractionManager.runAfterInteractions(() => {
40
44
  navigator?.maxApi?.showToastDebug?.({
41
45
  appId: context.appId,
@@ -114,15 +118,21 @@ const StackScreen: React.FC<ScreenParams> = props => {
114
118
  endTime.current = Date.now();
115
119
  clearTimeout(timeout.current);
116
120
  timeout.current = setTimeout(() => {
117
- timeLoad.current = endTime.current - startTime.current;
118
- navigator?.maxApi?.showToastDebug?.({
119
- appId: context.appId,
120
- message: `${Component.name} screen_load_time ${timeLoad.current}`,
121
- });
121
+ if (timeLoad.current === 0) {
122
+ timeLoad.current = endTime.current - startTime.current;
123
+ navigator?.maxApi?.showToastDebug?.({
124
+ appId: context.appId,
125
+ message: `${Component.name} screen_load_time ${timeLoad.current}`,
126
+ });
127
+ }
122
128
  }, 1000);
123
129
  },
124
130
  }}>
125
- <Component heightHeader={heightHeader} {...data} />
131
+ <Component
132
+ heightHeader={heightHeader}
133
+ {...data}
134
+ onScreenLoad={() => {}}
135
+ />
126
136
  {showGrid && <GridSystem />}
127
137
  </ScreenContext.Provider>
128
138
  );
@@ -4,10 +4,8 @@ import {
4
4
  HeaderAnimated,
5
5
  HeaderBackground,
6
6
  HeaderCustom,
7
- HeaderLeft,
8
7
  HeaderRightAction,
9
8
  HeaderTitle,
10
- HeaderToolkitAction,
11
9
  NavigationButton,
12
10
  } from './Components';
13
11
  import BottomTab from './BottomTab';
@@ -32,10 +30,8 @@ export {
32
30
  BottomTab,
33
31
  NavigationButton,
34
32
  HeaderTitle,
35
- HeaderLeft,
36
33
  HeaderBackground,
37
34
  HeaderRightAction,
38
- HeaderToolkitAction,
39
35
  HeaderCustom,
40
36
  HeaderAnimated,
41
37
  };
@@ -1,4 +1,4 @@
1
- import {Animated} from 'react-native';
1
+ import {Animated, FlatListProps, ViewProps} from 'react-native';
2
2
  import {StackNavigationOptions} from '@react-navigation/stack';
3
3
  import React from 'react';
4
4
  import Navigator from './Navigator';
@@ -94,7 +94,7 @@ export type NavigationContainerProps = {
94
94
  options?: NavigationOptions;
95
95
  theme: Theme;
96
96
  maxApi: any;
97
- params: Record<string, any>;
97
+ initialParams: Record<string, any>;
98
98
  localization?: LocalizationObject;
99
99
  };
100
100
 
@@ -119,8 +119,8 @@ export interface ModalParams extends ScreenParams {
119
119
  export interface BottomSheetParams extends ScreenParams {
120
120
  [key: string]: any;
121
121
  onDismiss?: () => void;
122
- snapPoint?: '30%' | '50%' | '70%' | '90%' | 'content';
123
- indicatorColor?: string;
122
+ footerComponent?: React.ReactNode;
123
+ flatListProps: FlatListProps<any>;
124
124
  }
125
125
 
126
126
  export type NavigationButtonProps = {
@@ -154,6 +154,7 @@ export interface NavigationOptions extends StackNavigationOptions {
154
154
  toolkitParams?: {
155
155
  pinnedTool?: PinnedToolType;
156
156
  runtimeTools?: RuntimeToolType[];
157
+ preventClose?: PopupNotifyProps;
157
158
  };
158
159
  }
159
160
 
@@ -185,11 +186,10 @@ export type HeaderToolkitProps = {
185
186
  configs: any[];
186
187
  };
187
188
 
188
- export type HeaderAnimatedProps = {
189
+ export interface HeaderAnimatedProps extends ViewProps {
189
190
  animatedValue: Animated.Value;
190
191
  image: string;
191
- onPress?: () => void;
192
- };
192
+ }
193
193
 
194
194
  export type BottomTabItemProps = {
195
195
  name: string;
@@ -131,14 +131,7 @@ const getOptions = (params: NavigationOptions, theme: Theme) => {
131
131
  options = {
132
132
  ...options,
133
133
  headerRight: (props: any) => {
134
- return (
135
- <HeaderToolkitAction
136
- preventBack={params.preventBack}
137
- pinnedTool={params.toolkitParams?.pinnedTool}
138
- runtimeTools={params.toolkitParams?.runtimeTools}
139
- {...props}
140
- />
141
- );
134
+ return <HeaderToolkitAction {...params.toolkitParams} {...props} />;
142
135
  },
143
136
  };
144
137
  }
@@ -162,7 +155,7 @@ const getAccessibilityID = (key = '') => {
162
155
  }
163
156
  };
164
157
 
165
- const formatComponentName = (word: string) => {
158
+ const formatComponentName = (word = '') => {
166
159
  const accentsMap = {
167
160
  a: 'á|à|ả|ã|ạ|â|ấ|ầ|ẩ|ẫ|ậ|ă|ắ|ằ|ẳ|ẵ|ặ',
168
161
  A: 'Á|À|Ả|Ã|Ạ|Â|Ấ|Ầ|Ẩ|Ẫ|Ậ|Ă|Ắ|Ằ|Ẳ|Ẵ|Ặ',
@@ -190,7 +183,7 @@ const formatComponentName = (word: string) => {
190
183
  return word;
191
184
  };
192
185
 
193
- const formatNameLength = (name: string) => {
186
+ const formatNameLength = (name = '') => {
194
187
  let formattedName = name;
195
188
  if (formattedName.length > 100) {
196
189
  formattedName = formattedName.substring(0, 100);
package/Button/index.tsx CHANGED
@@ -78,6 +78,8 @@ export interface ButtonProps extends TouchableOpacityProps {
78
78
  params?: any;
79
79
 
80
80
  componentId?: string;
81
+
82
+ accessibilityID?: object
81
83
  }
82
84
 
83
85
  const Button: FC<ButtonProps> = ({
@@ -93,6 +95,7 @@ const Button: FC<ButtonProps> = ({
93
95
  params,
94
96
  componentId,
95
97
  accessibilityLabel,
98
+ accessibilityID,
96
99
  ...rest
97
100
  }) => {
98
101
  const {theme, config} = useContext(ApplicationContext);
@@ -303,7 +306,7 @@ const Button: FC<ButtonProps> = ({
303
306
  };
304
307
 
305
308
  const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
306
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|btn_${title}`)
309
+ const selfAccessibilityID = accessibilityID ? accessibilityID : getAccessibilityID?.(`${appId}/${code}/${screenInfo.screenName}/btn_${title}`)
307
310
  return (
308
311
  <ScreenContext.Provider
309
312
  value={{
@@ -321,7 +324,7 @@ const Button: FC<ButtonProps> = ({
321
324
  }}>
322
325
  <TouchableOpacity
323
326
  {...rest}
324
- {...accessibilityID}
327
+ {...selfAccessibilityID}
325
328
  activeOpacity={activeOpacity}
326
329
  onPress={onPressButton}
327
330
  style={buttonStyle}>
@@ -42,7 +42,7 @@ const CheckBox: FC<CheckBoxProps> = ({
42
42
  backgroundColor = theme.colors.background.tonal;
43
43
  }
44
44
  }
45
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|cbx_${label}_${value}`)
45
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/cbx_${label}_${value}`)
46
46
 
47
47
  return (
48
48
  <ScreenContext.Provider
package/Image/index.tsx CHANGED
@@ -42,7 +42,7 @@ const Image: React.FC<ImageProps> = ({
42
42
  return children;
43
43
  };
44
44
 
45
- const accessibilityID = getAccessibilityID(`img|${source}`)
45
+ const accessibilityID = getAccessibilityID?.(`img|${source}`)
46
46
  return (
47
47
  <FastImage
48
48
  {...rest}
package/Input/Input.tsx CHANGED
@@ -121,6 +121,7 @@ const Input = forwardRef(
121
121
  placeholderColor = disabledColor;
122
122
  iconTintColor = disabledColor;
123
123
  }
124
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
124
125
 
125
126
  return (
126
127
  <View
@@ -149,6 +150,7 @@ const Input = forwardRef(
149
150
  )}
150
151
  <TextInput
151
152
  {...props}
153
+ {...accessibilityID}
152
154
  editable={!disabled}
153
155
  secureTextEntry={secure}
154
156
  textAlignVertical="center"
@@ -202,7 +204,6 @@ const Input = forwardRef(
202
204
  inputState = 'disabled';
203
205
  }
204
206
 
205
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
206
207
 
207
208
  return (
208
209
  <ScreenContext.Provider
@@ -214,7 +215,7 @@ const Input = forwardRef(
214
215
  state: inputState,
215
216
  componentId,
216
217
  }}>
217
- <View {...accessibilityID} style={[style, styles.wrapper]}>
218
+ <View style={[style, styles.wrapper]}>
218
219
  {renderInputView()}
219
220
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
220
221
  </View>
@@ -60,6 +60,7 @@ const InputDropDown = ({
60
60
  placeholderColor = disabledColor;
61
61
  iconTintColor = disabledColor;
62
62
  }
63
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
63
64
 
64
65
  return (
65
66
  <View
@@ -89,6 +90,7 @@ const InputDropDown = ({
89
90
  {full && (
90
91
  <TextInput
91
92
  {...props}
93
+ {...accessibilityID}
92
94
  onPressIn={onPress}
93
95
  editable={false}
94
96
  textAlignVertical="top"
@@ -112,7 +114,6 @@ const InputDropDown = ({
112
114
  );
113
115
  };
114
116
 
115
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
116
117
 
117
118
 
118
119
  return (
@@ -126,7 +127,6 @@ const InputDropDown = ({
126
127
  componentId,
127
128
  }}>
128
129
  <TouchableOpacity
129
- {...accessibilityID}
130
130
  onPress={onPress}
131
131
  style={[style, full && styles.wrapper]}>
132
132
  {renderInputView()}
@@ -104,6 +104,7 @@ const InputMoney = forwardRef(
104
104
  placeholderColor = disabledColor;
105
105
  iconTintColor = disabledColor;
106
106
  }
107
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
107
108
 
108
109
  return (
109
110
  <View
@@ -123,6 +124,7 @@ const InputMoney = forwardRef(
123
124
  <View style={styles.inputView}>
124
125
  <TextInput
125
126
  {...props}
127
+ {...accessibilityID}
126
128
  editable={!disabled}
127
129
  textAlignVertical="top"
128
130
  ref={inputRef}
@@ -173,7 +175,6 @@ const InputMoney = forwardRef(
173
175
  inputState = 'disabled';
174
176
  }
175
177
 
176
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
177
178
 
178
179
  return (
179
180
  <ScreenContext.Provider
@@ -186,7 +187,6 @@ const InputMoney = forwardRef(
186
187
  componentId,
187
188
  }}>
188
189
  <View
189
- {...accessibilityID}
190
190
  style={[style, styles.wrapper]}>
191
191
  {renderInputView()}
192
192
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
@@ -191,6 +191,7 @@ const InputOTP = forwardRef(
191
191
  );
192
192
  };
193
193
 
194
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}`)
194
195
  const renderInputView = () => {
195
196
  return (
196
197
  <View
@@ -216,6 +217,7 @@ const InputOTP = forwardRef(
216
217
  <View style={styles.inputView}>
217
218
  <TextInput
218
219
  {...props}
220
+ {...accessibilityID}
219
221
  ref={inputRef}
220
222
  value={value}
221
223
  onChangeText={_onChangeText}
@@ -230,7 +232,6 @@ const InputOTP = forwardRef(
230
232
  </View>
231
233
  );
232
234
  };
233
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
234
235
 
235
236
  return (
236
237
  <ScreenContext.Provider
@@ -243,7 +244,6 @@ const InputOTP = forwardRef(
243
244
  componentId,
244
245
  }}>
245
246
  <TouchableOpacity
246
- {...accessibilityID}
247
247
  activeOpacity={1}
248
248
  onPress={onFocusInput}
249
249
  style={[style, styles.otpWrapper]}>
@@ -66,11 +66,13 @@ const InputSearch = forwardRef(
66
66
  checkTyping(text, haveValue, setHaveValue);
67
67
  onChangeText?.(text);
68
68
  };
69
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_search`)
69
70
 
70
71
  const renderInputView = () => {
71
72
  return (
72
73
  <TextInput
73
74
  {...props}
75
+ {...accessibilityID}
74
76
  textAlignVertical="center"
75
77
  ref={inputRef}
76
78
  style={[
@@ -139,11 +141,9 @@ const InputSearch = forwardRef(
139
141
  const backgroundColor = hasColorBG
140
142
  ? theme.colors.background.default
141
143
  : theme.colors.background.surface;
142
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_search`)
143
144
 
144
145
  return (
145
146
  <ScreenContext.Provider
146
- {...accessibilityID}
147
147
  value={{
148
148
  ...screenInfo,
149
149
  componentName: 'InputSearch',
@@ -94,6 +94,7 @@ const InputTextArea = forwardRef(
94
94
  textColor = disabledColor;
95
95
  placeholderColor = disabledColor;
96
96
  }
97
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/input_${floatingValue}${disabled && "_disabled" }`)
97
98
 
98
99
  return (
99
100
  <View
@@ -116,6 +117,7 @@ const InputTextArea = forwardRef(
116
117
  <View style={styles.textAreaView}>
117
118
  <TextInput
118
119
  {...props}
120
+ {...accessibilityID}
119
121
  ref={inputRef}
120
122
  editable={!disabled}
121
123
  textAlignVertical="top"
@@ -153,11 +155,9 @@ const InputTextArea = forwardRef(
153
155
  </View>
154
156
  );
155
157
  };
156
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|input_${floatingValue}${disabled && "_disabled" }`)
157
158
 
158
159
  return (
159
160
  <View
160
- {...accessibilityID}
161
161
  style={[style, styles.wrapper]}>
162
162
  {renderInputView()}
163
163
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
package/Input/styles.ts CHANGED
@@ -7,7 +7,7 @@ export default StyleSheet.create({
7
7
  input: {
8
8
  flex: 1,
9
9
  paddingLeft: Spacing.M,
10
- fontSize: scaleSize(15),
10
+ fontSize: scaleSize(14),
11
11
  },
12
12
  wrapper: {
13
13
  width: '100%',
@@ -75,7 +75,7 @@ export default StyleSheet.create({
75
75
  flex: 1,
76
76
  paddingRight: Spacing.XS,
77
77
  paddingVertical: Spacing.XS,
78
- fontSize: scaleSize(15),
78
+ fontSize: scaleSize(14),
79
79
  },
80
80
  textAreaWrapper: {
81
81
  borderWidth: 1,
@@ -108,7 +108,7 @@ export default StyleSheet.create({
108
108
  height: 36,
109
109
  marginLeft: Spacing.S,
110
110
  flex: 1,
111
- fontSize: scaleSize(15),
111
+ fontSize: scaleSize(14),
112
112
  paddingVertical: Spacing.XS,
113
113
  },
114
114
  searchInputView: {
@@ -109,13 +109,13 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
109
109
  );
110
110
  };
111
111
  const renderColumn = () => {
112
- const accessibilityPrimaryID = getAccessibilityID('btn_popup_allow')
113
- const accessibilitySecondID = getAccessibilityID('btn_popup_cancel')
112
+ const accessibilityPrimaryID = getAccessibilityID?.('btn_popup_allow')
113
+ const accessibilitySecondID = getAccessibilityID?.('btn_popup_cancel')
114
114
 
115
115
  return (
116
116
  <View style={Styles.columnCenter}>
117
117
  <Button
118
- {...accessibilityPrimaryID}
118
+ accessibilityID={accessibilityPrimaryID}
119
119
  title={primary.title}
120
120
  size="medium"
121
121
  onPress={() => {
@@ -127,7 +127,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
127
127
  <>
128
128
  <View style={styles.buttonSpace} />
129
129
  <Button
130
- {...accessibilitySecondID}
130
+ accessibilityID={accessibilitySecondID}
131
131
  title={secondary?.title}
132
132
  type="text"
133
133
  size="medium"
@@ -161,7 +161,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
161
161
  * build close action
162
162
  */
163
163
  const buildCloseIcon = () => {
164
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
164
+ const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
165
165
 
166
166
  return (
167
167
  <TouchableOpacity
@@ -189,7 +189,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
189
189
  );
190
190
  };
191
191
 
192
- const accessibilityID = getAccessibilityID(`pu_${context.code}_notify`)
192
+ const accessibilityID = getAccessibilityID?.(`pu_${context.code}_notify`)
193
193
 
194
194
  return (
195
195
  <View
@@ -49,7 +49,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
49
49
  * build close action
50
50
  */
51
51
  const buildCloseIcon = () => {
52
- const accessibilityCloseID = getAccessibilityID('ic_popup_close')
52
+ const accessibilityCloseID = getAccessibilityID?.('ic_popup_close')
53
53
 
54
54
  return (
55
55
  <View {...accessibilityCloseID} style={styles.iconCloseContainer}>
@@ -78,7 +78,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
78
78
  </View>
79
79
  );
80
80
  };
81
- const accessibilityID = getAccessibilityID(`pu_${context.code}_promotion`)
81
+ const accessibilityID = getAccessibilityID?.(`pu_${context.code}_promotion`)
82
82
 
83
83
  return (
84
84
  <View
package/Radio/index.tsx CHANGED
@@ -45,7 +45,7 @@ const Radio: FC<RadioProps> = ({
45
45
  : theme.colors.text.disable,
46
46
  };
47
47
  }
48
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|rdo_${label}_${value}`)
48
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/rdo_${label}_${value}`)
49
49
 
50
50
  return (
51
51
  <ScreenContext.Provider
package/Switch/index.tsx CHANGED
@@ -22,7 +22,7 @@ const Switch: FC<SwitchProps> = props => {
22
22
  if (disabled) {
23
23
  backgroundColor = value ? Colors.green_09 : Colors.black_05;
24
24
  }
25
- const accessibilityID = getAccessibilityID(`${appId}|${screenInfo.screenName}|swt_${value}`)
25
+ const accessibilityID = getAccessibilityID?.(`${appId}/${screenInfo.screenName}/swt_${value}`)
26
26
 
27
27
  return (
28
28
  <ScreenContext.Provider
package/Text/index.tsx CHANGED
@@ -51,8 +51,9 @@ export interface TextProps extends RNTextProps {
51
51
  */
52
52
  color?: string;
53
53
  }
54
+
54
55
  const Text: React.FC<TextProps> = ({
55
- typography,
56
+ typography = 'body_default_regular',
56
57
  color,
57
58
  children,
58
59
  style,
@@ -94,6 +95,7 @@ const Text: React.FC<TextProps> = ({
94
95
  };
95
96
 
96
97
  const textStyle = getTypoStyle(typography);
98
+
97
99
  return (
98
100
  <RNText
99
101
  {...rest}
@@ -103,8 +105,4 @@ const Text: React.FC<TextProps> = ({
103
105
  );
104
106
  };
105
107
 
106
- Text.defaultProps = {
107
- typography: 'body_default_regular',
108
- };
109
-
110
108
  export {Text, scaleSize};
package/Text/styles.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export default {
2
- headline_default_bold: {fontSize: 24, lineHeight: 32, fontWeight: '700'},
3
- header_m_bold: {fontSize: 18, lineHeight: 28, fontWeight: '700'},
2
+ headline_default_bold: {fontSize: 24, lineHeight: 34, fontWeight: '700'},
3
+ header_m_bold: {fontSize: 18, lineHeight: 26, fontWeight: '700'},
4
4
  header_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
5
5
  header_s_semibold: {fontSize: 14, lineHeight: 20, fontWeight: '600'},
6
- header_xs_semibold: {fontSize: 12, lineHeight: 16, fontWeight: '600'},
6
+ header_xs_semibold: {fontSize: 12, lineHeight: 18, fontWeight: '600'},
7
7
  body_default_regular: {fontSize: 14, lineHeight: 20, fontWeight: '400'},
8
8
  body_regularstrikethrought: {
9
9
  fontSize: 14,
@@ -13,12 +13,12 @@ export default {
13
13
  },
14
14
  description_default_regular: {
15
15
  fontSize: 12,
16
- lineHeight: 16,
16
+ lineHeight: 18,
17
17
  fontWeight: '400',
18
18
  },
19
19
  description_default_regularstrikethrought: {
20
20
  fontSize: 12,
21
- lineHeight: 16,
21
+ lineHeight: 18,
22
22
  fontWeight: '400',
23
23
  textDecorationLine: 'line-through',
24
24
  },
@@ -30,11 +30,11 @@ export default {
30
30
  textDecorationLine: 'line-through',
31
31
  },
32
32
  label_default_medium: {fontSize: 14, lineHeight: 20, fontWeight: '500'},
33
- label_s_medium: {fontSize: 12, lineHeight: 16, fontWeight: '500'},
33
+ label_s_medium: {fontSize: 12, lineHeight: 18, fontWeight: '500'},
34
34
  label_xs_medium: {fontSize: 10, lineHeight: 14, fontWeight: '500'},
35
35
  action_default_bold: {fontSize: 16, lineHeight: 22, fontWeight: '700'},
36
36
  action_s_bold: {fontSize: 14, lineHeight: 20, fontWeight: '700'},
37
- action_xs_bold: {fontSize: 12, lineHeight: 16, fontWeight: '700'},
37
+ action_xs_bold: {fontSize: 12, lineHeight: 18, fontWeight: '700'},
38
38
  action_xxs_bold: {fontSize: 10, lineHeight: 14, fontWeight: '700'},
39
39
  /**non-support**/
40
40
  headline_default: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.92.1-tracking.1",
3
+ "version": "0.92.1-tracking.13",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -10,10 +10,10 @@
10
10
  "@momo-kits/foundation"
11
11
  ],
12
12
  "dependencies": {
13
- "@gorhom/bottom-sheet": "git+https://gitlab.com/momo-platform/bottom-sheet.git#main",
14
13
  "react-native-safe-area-context": "3.1.4",
15
14
  "react-native-linear-gradient": "2.8.3",
16
15
  "react-native-gesture-handler": "1.10.3",
16
+ "react-native-modalize": "2.1.1",
17
17
  "react-native-fast-image": "8.1.5",
18
18
  "@react-navigation/bottom-tabs": "git+https://gitlab.com/momo-platform/react-navigation-bottom-tabs.git#main",
19
19
  "@react-navigation/core": "5.16.1",
package/verify.js CHANGED
@@ -2,21 +2,24 @@ const fs = require('fs');
2
2
  const path = require('path');
3
3
 
4
4
  try {
5
- const package = path.join(`${__dirname}`, 'package.json');
6
- const packageInfo = JSON.parse(fs.readFileSync(package, 'utf8'));
5
+ const packageInfo = JSON.parse(
6
+ fs.readFileSync(path.join(`${__dirname}`, 'package.json'), 'utf8'),
7
+ );
7
8
  const packageVersion = parseInt(packageInfo?.version.split('.')?.[1]);
8
9
 
9
10
  const app = path.join(`${__dirname}/../../../`, 'app.json');
10
11
  const miniJson = path.join(`${__dirname}/../../../`, 'package.json');
12
+
13
+ if (!fs.existsSync(app) || fs.existsSync(miniJson)) {
14
+ return;
15
+ }
16
+
11
17
  const appInfo = JSON.parse(fs.readFileSync(app, 'utf8'));
12
18
  const miniInfo = JSON.parse(fs.readFileSync(miniJson, 'utf8'));
19
+
13
20
  const iOSAppTarget = appInfo?.client?.ios.deploymentTarget;
14
21
  const androidAppTarget = appInfo?.client?.android.deploymentTarget;
15
22
 
16
- if (appInfo.name === 'MoMoPlatform') {
17
- return;
18
- }
19
-
20
23
  if (packageVersion > iOSAppTarget || packageVersion > androidAppTarget) {
21
24
  console.error(
22
25
  `Package ${packageInfo.name} version: ${packageInfo.version} require deploymentTarget ${packageVersion}`,