@momo-kits/foundation 0.103.4 → 0.103.6

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.
@@ -94,6 +94,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
94
94
  height: 68,
95
95
  paddingVertical: 10,
96
96
  },
97
+ inactiveTintColor: theme.colors.text.secondary,
97
98
  }}>
98
99
  {tabs.map(item => {
99
100
  const isNum = !isNaN(parseInt(`${item?.badgeLabel}`));
@@ -4,7 +4,7 @@ import defaultLanguage from '../Assets/language.json';
4
4
 
5
5
  class Localize {
6
6
  private assets: LocalizationObject;
7
- private currentLanguage: 'en' | 'vi';
7
+ private readonly currentLanguage: 'en' | 'vi';
8
8
 
9
9
  constructor(assets: LocalizationObject) {
10
10
  this.assets = {
@@ -1,12 +1,10 @@
1
1
  import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
2
2
  import {useHeaderHeight} from '@react-navigation/stack';
3
- import {Alert, InteractionManager, Linking, View} from 'react-native';
3
+ import {InteractionManager} from 'react-native';
4
4
  import {ScreenParams} from './types';
5
5
  import Navigation from './Navigation';
6
6
  import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
7
7
  import {GridSystem} from '../Layout';
8
- import {Text} from '../Text';
9
- import {Colors, Radius, Spacing} from '../Consts';
10
8
 
11
9
  /**
12
10
  * container for stack screen
@@ -68,10 +66,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
68
66
  * tracking for screen
69
67
  */
70
68
  useEffect(() => {
71
- if (['Invalid', 'screen'].includes(screenName) && context.enableAutoId) {
72
- setTimeout(() => {
73
- navigator?.showModal({screen: EmptyScreen});
74
- }, 300);
69
+ if (['Invalid', 'screen'].includes(screenName)) {
70
+ navigator?.maxApi.showPopup('notice', {
71
+ title: 'Invalid screen name',
72
+ message:
73
+ 'Your screen has not been rendered because Platform has not detected the screen name. Please migrate to support this feature.',
74
+ });
75
75
  }
76
76
 
77
77
  const subscription = props.navigation?.addListener?.('focus', () => {
@@ -114,23 +114,21 @@ const StackScreen: React.FC<ScreenParams> = props => {
114
114
  */
115
115
  const onScreenLoad = () => {
116
116
  if (!tracking.current?.releaseLoad) {
117
- if (tracking.current.timeLoad === 0) {
118
- tracking.current.timeLoad =
119
- tracking.current.endTime - tracking.current.startTime;
117
+ let timeLoad = tracking.current.timeLoad;
118
+ if (timeLoad === 0) {
119
+ timeLoad = tracking.current.endTime - tracking.current.startTime;
120
120
  }
121
121
 
122
122
  context.autoTracking?.({
123
- appId: context.appId,
124
- code: context.code,
125
- buildNumber: context.buildNumber,
123
+ ...context,
126
124
  screenName,
127
125
  componentName: 'Screen',
128
126
  state: 'load',
129
- duration: tracking.current.timeLoad,
127
+ duration: timeLoad,
130
128
  });
131
129
  navigator?.maxApi?.stopTrace?.(
132
130
  tracking.current.traceIdLoad,
133
- {value: tracking.current.timeLoad / 1000},
131
+ {value: timeLoad / 1000},
134
132
  null
135
133
  );
136
134
  tracking.current.releaseLoad = true;
@@ -140,12 +138,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
140
138
  */
141
139
  navigator?.maxApi?.showToastDebug?.({
142
140
  appId: context.appId,
143
- message: `${screenName} screen_load_time ${tracking.current.timeLoad}`,
141
+ message: `${screenName} screen_load_time ${timeLoad}`,
144
142
  type: 'ERROR',
145
143
  });
146
- if (tracking.current.timeLoad <= 0 && context.enableAutoId) {
147
- Alert.alert(screenName, "Can't get screen load time");
148
- }
149
144
  }
150
145
  };
151
146
 
@@ -154,22 +149,20 @@ const StackScreen: React.FC<ScreenParams> = props => {
154
149
  */
155
150
  const onScreenInteraction = () => {
156
151
  if (!tracking.current?.releaseInteraction) {
157
- if (tracking.current.timeLoad === 0) {
158
- tracking.current.timeLoad =
159
- tracking.current.endTime - tracking.current.startTime;
152
+ let timeLoad = tracking.current.timeLoad;
153
+ if (timeLoad === 0) {
154
+ timeLoad = tracking.current.endTime - tracking.current.startTime;
160
155
  }
161
156
  if (tracking.current.timeInteraction === 0) {
162
- tracking.current.timeInteraction = tracking.current.timeLoad;
157
+ tracking.current.timeInteraction = timeLoad;
163
158
  }
164
159
 
165
160
  context.autoTracking?.({
166
- appId: context.appId,
167
- code: context.code,
168
- buildNumber: context.buildNumber,
161
+ ...context,
169
162
  screenName,
170
163
  componentName: 'Screen',
171
164
  state: 'interaction',
172
- duration: tracking.current.timeInteraction - tracking.current.timeLoad,
165
+ duration: tracking.current.timeInteraction - timeLoad,
173
166
  totalDuration: tracking.current.timeInteraction,
174
167
  });
175
168
  navigator?.maxApi?.stopTrace?.(
@@ -187,9 +180,6 @@ const StackScreen: React.FC<ScreenParams> = props => {
187
180
  message: `${screenName} screen_interaction_time ${tracking.current.timeInteraction}`,
188
181
  type: 'ERROR',
189
182
  });
190
- if (tracking.current.timeInteraction <= 0 && context.enableAutoId) {
191
- Alert.alert(screenName, "Can't get screen interaction time");
192
- }
193
183
  }
194
184
  };
195
185
 
@@ -198,9 +188,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
198
188
  */
199
189
  const onScreenNavigated = (preScreenName: string) => {
200
190
  context.autoTracking?.({
201
- appId: context.appId,
202
- code: context.code,
203
- buildNumber: context.buildNumber,
191
+ ...context,
204
192
  preScreenName,
205
193
  screenName,
206
194
  componentName: 'Screen',
@@ -231,98 +219,19 @@ const StackScreen: React.FC<ScreenParams> = props => {
231
219
  Date.now() - tracking.current.startTime;
232
220
  });
233
221
  tracking.current.timeoutLoad = setTimeout(() => {
222
+ const time = tracking.current.endTime - tracking.current.startTime;
234
223
  if (tracking.current.timeLoad === 0) {
235
- tracking.current.timeLoad =
236
- tracking.current.endTime - tracking.current.startTime;
224
+ tracking.current.timeLoad = time;
237
225
  }
238
226
  onScreenLoad();
239
227
  onScreenInteraction();
240
228
  }, 2000);
241
229
  },
242
230
  }}>
243
- <Component
244
- heightHeader={heightHeader}
245
- {...data}
246
- onScreenLoad={onScreenLoad}
247
- onScreenInteraction={onScreenInteraction}
248
- />
231
+ <Component heightHeader={heightHeader} {...data} />
249
232
  {showGrid && <GridSystem />}
250
233
  </ScreenContext.Provider>
251
234
  );
252
235
  };
253
236
 
254
- /**
255
- * Empty screen for unvalidated screen name
256
- * @constructor
257
- */
258
- const EmptyScreen: React.FC = () => {
259
- return (
260
- <View
261
- style={{
262
- backgroundColor: Colors.black_01,
263
- padding: Spacing.M,
264
- borderRadius: Radius.M,
265
- }}>
266
- <Text typography={'header_m_bold'}>Unvalidated screen name</Text>
267
- <Text
268
- typography={'description_default_regular'}
269
- style={{paddingVertical: Spacing.S}}>
270
- Your screen has not been rendered because Platform has not detected the
271
- screen name. Please migrate to support this feature.
272
- </Text>
273
- <Text typography={'header_default'} style={{width: '100%'}}>
274
- Possible fixes:
275
- </Text>
276
- <View style={{marginLeft: Spacing.S}}>
277
- <Text typography={'body_default_regular'}>1. Off webpack config</Text>
278
- <Text typography={'body_default_regular'}>
279
- 2. Screen name refactoring
280
- </Text>
281
- <View style={{marginLeft: Spacing.S}}>
282
- <Text
283
- typography={'description_default_regular'}
284
- style={{marginBottom: Spacing.S}}>
285
- - Với các screen push/import dạng arrow function ={'>'} đổi thành
286
- named function
287
- </Text>
288
- <Text
289
- typography={'description_default_regular'}
290
- style={{marginBottom: Spacing.S}}>
291
- - Với các screen import dạng High Order Component ={'>'} rename
292
- generic function thành named function
293
- </Text>
294
- <Text
295
- typography={'description_default_regular'}
296
- style={{marginBottom: Spacing.S}}>
297
- - Với Tab Navigator, Platform sẽ lấy Tab Container làm screen name.
298
- Trong trường hợp miniapp muốn track riêng action cho từng tab, tham
299
- khảo theo docs
300
- </Text>
301
- </View>
302
- </View>
303
- <Text typography={'header_s_semibold'}>More information: </Text>
304
- <Text
305
- typography={'body_default_regular'}
306
- color={Colors.blue_01}
307
- onPress={() => {
308
- Linking.openURL(
309
- 'https://gitlab.mservice.com.vn/momo-platform/mini-app/-/tree/vn.momo.uikits/dev/app'
310
- );
311
- }}>
312
- Mini App: vn.momo.uikits/dev
313
- </Text>
314
- <Text
315
- typography={'body_default_regular'}
316
- color={Colors.blue_01}
317
- onPress={() => {
318
- Linking.openURL(
319
- 'https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing'
320
- );
321
- }}>
322
- https://docs.google.com/presentation/d/1bIFoh8gRXb6hsnGJz4O1Kxg4_oNikB1KuuEt2wULCDM/edit?usp=sharing
323
- </Text>
324
- </View>
325
- );
326
- };
327
-
328
237
  export default StackScreen;
@@ -12,7 +12,6 @@ import {
12
12
  NativeSyntheticEvent,
13
13
  TextInput,
14
14
  TextInputFocusEventData,
15
- TouchableOpacity,
16
15
  View,
17
16
  } from 'react-native';
18
17
  import {ApplicationContext, ComponentContext} from '../Application';
@@ -94,17 +93,14 @@ const InputOTP = forwardRef(
94
93
  onChangeText: (text: string) => {
95
94
  _onChangeText(text);
96
95
  },
97
- focus: () => {
98
- setFocused(true);
99
- inputRef.current?.focus()
100
- },
96
+ focus: () => inputRef.current?.focus(),
101
97
  blur: () => inputRef.current?.blur(),
102
98
  setText: (text: string) => _onChangeText(text),
103
99
  }));
104
100
 
105
- const onFocusInput = () => {
101
+ const onFocusInput = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
106
102
  setFocused(true);
107
- inputRef.current?.focus();
103
+ onFocus?.(e);
108
104
  };
109
105
 
110
106
  const onBlurInput = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
@@ -211,7 +207,7 @@ const InputOTP = forwardRef(
211
207
  <View style={styles.otpInputsView}>
212
208
  {length ? renderInputs(length) : renderUnidentifiedInputs()}
213
209
  </View>
214
- <View style={styles.inputView}>
210
+ <View style={styles.otpRealInputWrapper}>
215
211
  <TextInput
216
212
  {...props}
217
213
  accessibilityLabel={accessibilityLabel}
@@ -219,9 +215,9 @@ const InputOTP = forwardRef(
219
215
  value={value}
220
216
  onChangeText={_onChangeText}
221
217
  keyboardType={dataType === 'number' ? 'number-pad' : 'default'}
222
- onFocus={onFocus}
218
+ onFocus={onFocusInput}
223
219
  onBlur={onBlurInput}
224
- style={{opacity: 0}}
220
+ style={styles.otpRealInput}
225
221
  selectionColor={theme.colors.primary}
226
222
  placeholderTextColor={theme.colors.text.hint}
227
223
  />
@@ -239,17 +235,14 @@ const InputOTP = forwardRef(
239
235
  state: 'enabled',
240
236
  componentId: accessibilityLabel,
241
237
  }}>
242
- <TouchableOpacity
243
- activeOpacity={1}
244
- onPress={onFocusInput}
245
- style={[style, styles.otpWrapper]}>
238
+ <View style={[style, styles.otpWrapper]}>
246
239
  {renderInputView()}
247
240
  <ErrorView
248
241
  errorMessage={errorMessage}
249
242
  errorSpacing={errorSpacing}
250
243
  hintText={hintText}
251
244
  />
252
- </TouchableOpacity>
245
+ </View>
253
246
  </ComponentContext.Provider>
254
247
  );
255
248
  }
package/Input/styles.ts CHANGED
@@ -164,6 +164,22 @@ export default StyleSheet.create({
164
164
  alignItems: 'center',
165
165
  justifyContent: 'center',
166
166
  },
167
+ otpRealInputWrapper: {
168
+ flex: 1,
169
+ flexDirection: 'row',
170
+ alignItems: 'center',
171
+ position: 'absolute',
172
+ width: '100%',
173
+ height: '100%',
174
+ opacity: 0.01,
175
+ backgroundColor: 'transparent',
176
+ },
177
+ otpRealInput: {
178
+ opacity: 0.01,
179
+ width: '100%',
180
+ height: '100%',
181
+ zIndex: 1,
182
+ },
167
183
 
168
184
  //DropDown
169
185
  inputDropDownWrapper: {
package/Layout/Screen.tsx CHANGED
@@ -143,9 +143,10 @@ const Screen = forwardRef(
143
143
 
144
144
  let handleScroll;
145
145
  let Component: any = View;
146
- let keyboardOffset = heightHeader - 20;
146
+
147
+ let keyboardOffset = heightHeader - Math.min(insets.bottom, 21);
147
148
  if (headerType === 'extended' || animatedHeader || inputSearchProps) {
148
- keyboardOffset = -20;
149
+ keyboardOffset = -Math.min(insets.bottom, 21);
149
150
  }
150
151
 
151
152
  useEffect(() => {
@@ -40,8 +40,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
40
40
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
41
41
  }
42
42
  const tracking = {
43
- appId: context.appId,
44
- code: context.code,
43
+ ...context,
45
44
  screen_name,
46
45
  component_type: 'popup',
47
46
  component_name: id,
@@ -26,8 +26,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
26
26
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
27
27
  }
28
28
  const tracking = {
29
- appId: context.appId,
30
- code: context.code,
29
+ ...context,
31
30
  screen_name,
32
31
  component_type: 'popup',
33
32
  component_name: id,
package/Title/index.tsx CHANGED
@@ -115,7 +115,8 @@ const Title: FC<TitleProps> = ({
115
115
  return (
116
116
  <TouchableOpacity
117
117
  onPress={onPressTrailingAction}
118
- style={styles.iconLeftView}>
118
+ style={styles.iconLeftView}
119
+ hitSlop={{top: 10, bottom: 10, left: 50, right: 10}}>
119
120
  {showTrailingAction && !showRightAction && (
120
121
  <View
121
122
  style={[
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.103.4",
3
+ "version": "0.103.6",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},