@momo-kits/foundation 0.81.52 → 0.81.53-beta.0

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 (60) hide show
  1. package/Application/BottomSheet.tsx +216 -0
  2. package/Application/BottomTab/BottomTabBar.tsx +278 -0
  3. package/Application/{BottomTab.tsx → BottomTab/index.tsx} +43 -18
  4. package/Application/Components.tsx +71 -53
  5. package/Application/ModalScreen.tsx +12 -183
  6. package/Application/Navigation.ts +2 -2
  7. package/Application/NavigationContainer.tsx +54 -53
  8. package/Application/Navigator.ts +53 -35
  9. package/Application/StackScreen.tsx +225 -30
  10. package/Application/index.ts +8 -12
  11. package/Application/types.ts +45 -27
  12. package/Application/utils.tsx +19 -15
  13. package/Assets/icon_bank.json +1 -1
  14. package/Badge/Badge.tsx +1 -1
  15. package/Button/index.tsx +44 -25
  16. package/CheckBox/index.tsx +37 -26
  17. package/CheckBox/types.ts +5 -3
  18. package/Consts/colors+spacing+radius.ts +14 -0
  19. package/Icon/index.tsx +9 -8
  20. package/Icon/types.ts +2 -2
  21. package/IconButton/index.tsx +24 -14
  22. package/Image/index.tsx +23 -8
  23. package/Image/types.ts +2 -0
  24. package/Input/Input.tsx +116 -26
  25. package/Input/InputDropDown.tsx +66 -51
  26. package/Input/InputMoney.tsx +106 -15
  27. package/Input/InputOTP.tsx +45 -22
  28. package/Input/InputSearch.tsx +92 -44
  29. package/Input/InputTextArea.tsx +26 -6
  30. package/Input/common.tsx +48 -22
  31. package/Input/index.tsx +94 -77
  32. package/Input/styles.ts +35 -5
  33. package/Input/utils.ts +1 -1
  34. package/Layout/Card.tsx +4 -3
  35. package/Layout/FloatingButton.tsx +168 -0
  36. package/Layout/GridSystem.tsx +1 -1
  37. package/Layout/ItemList.tsx +3 -2
  38. package/Layout/Screen.tsx +87 -49
  39. package/Layout/Section.tsx +4 -3
  40. package/Layout/styles.ts +11 -7
  41. package/Layout/utils.ts +4 -4
  42. package/Loader/index.tsx +2 -0
  43. package/Popup/PopupNotify.tsx +55 -44
  44. package/Popup/PopupPromotion.tsx +5 -7
  45. package/Popup/types.ts +1 -7
  46. package/Radio/index.tsx +35 -20
  47. package/Radio/types.ts +5 -3
  48. package/Switch/index.tsx +32 -18
  49. package/Switch/types.ts +5 -3
  50. package/Tag/styles.ts +3 -2
  51. package/Text/index.tsx +24 -5
  52. package/Text/styles.ts +8 -8
  53. package/Title/index.tsx +170 -103
  54. package/Title/styles.ts +36 -9
  55. package/Title/types.ts +16 -48
  56. package/code-scanner.js +125 -16
  57. package/index.ts +7 -0
  58. package/package.json +6 -6
  59. package/publish.sh +16 -21
  60. package/tsconfig.json +1 -1
package/Layout/Screen.tsx CHANGED
@@ -1,3 +1,12 @@
1
+ import {useHeaderHeight} from '@react-navigation/stack';
2
+ import React, {
3
+ forwardRef,
4
+ Fragment,
5
+ ReactNode,
6
+ useContext,
7
+ useEffect,
8
+ useRef,
9
+ } from 'react';
1
10
  import {
2
11
  Animated,
3
12
  KeyboardAvoidingView,
@@ -8,30 +17,25 @@ import {
8
17
  View,
9
18
  ViewProps,
10
19
  } from 'react-native';
11
- import {useHeaderHeight} from '@react-navigation/stack';
12
20
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
13
- import React, {
14
- forwardRef,
15
- Fragment,
16
- ReactNode,
17
- useContext,
18
- useEffect,
19
- useRef,
20
- } from 'react';
21
- import {Colors, Spacing, Styles} from '../Consts';
22
- import {Card, Section, validateChildren} from './index';
23
21
  import {
24
22
  ApplicationContext,
25
23
  HeaderBackground,
26
24
  HeaderTitle,
27
25
  } from '../Application';
28
26
  import Navigation from '../Application/Navigation';
29
- import styles from './styles';
30
27
  import {AnimatedHeader, NavigationOptions} from '../Application/types';
28
+ import {Colors, Spacing, Styles} from '../Consts';
29
+ import {FloatingButton, FloatingButtonProps} from './FloatingButton';
31
30
  import {Image} from '../Image';
31
+ import {Card, Section, validateChildren} from './index';
32
+ import styles from './styles';
32
33
  import {HeaderType} from './types';
33
34
 
34
35
  export interface ScreenProps extends ViewProps {
36
+ /**
37
+ * ReactNode representing the content of the screen.
38
+ */
35
39
  children: React.ReactNode;
36
40
  /**
37
41
  * Optional. Navigation object for handling navigation actions.
@@ -82,6 +86,21 @@ export interface ScreenProps extends ViewProps {
82
86
  * Optional. layout card offset overlap header banner.
83
87
  */
84
88
  layoutOffset?: -8 | -24 | -56;
89
+
90
+ /**
91
+ * Optional. Props for the floating action button.
92
+ */
93
+ floatingButtonProps?: Omit<FloatingButtonProps, 'animatedValue' | 'bottom'>;
94
+
95
+ /**
96
+ * Optional. Keyboard vertical offset.
97
+ */
98
+ keyboardVerticalOffset?: number;
99
+
100
+ /**
101
+ * Optional. If `true`, the screen content is using grid layout by span.
102
+ */
103
+ useGridLayout?: boolean;
85
104
  }
86
105
 
87
106
  const Screen = forwardRef(
@@ -98,26 +117,29 @@ const Screen = forwardRef(
98
117
  layoutOffset = -56,
99
118
  backgroundColor,
100
119
  headerType = 'default',
120
+ floatingButtonProps,
121
+ useGridLayout = true,
122
+ keyboardVerticalOffset,
101
123
  }: ScreenProps,
102
- ref,
124
+ ref
103
125
  ) => {
104
- const animatedValue = useRef<Animated.Value | undefined>(undefined);
126
+ const animatedValue = useRef<Animated.Value>(new Animated.Value(0));
105
127
  const {theme} = useContext(ApplicationContext);
106
128
  const insets = useSafeAreaInsets();
107
129
  const heightHeader = useHeaderHeight();
108
130
  const currentTint = useRef(Colors.black_01);
131
+ const isTab = navigation?.instance?.getState?.()?.type === 'tab';
132
+
109
133
  let styleAnimatedHeader: NavigationOptions;
110
134
  let handleScroll;
111
135
  let headerBackground: string | undefined = undefined;
112
136
  let Component: any = View;
113
- let keyboardVerticalOffset = heightHeader - 20;
114
- animatedValue.current = undefined;
115
-
116
- if (headerType == 'extended' || animatedHeader) {
117
- keyboardVerticalOffset = -20;
137
+ let keyboardOffset = heightHeader - 20;
138
+ if (headerType === 'extended' || animatedHeader) {
139
+ keyboardOffset = -20;
118
140
  }
119
141
 
120
- if (headerType == 'extended') {
142
+ if (headerType === 'extended') {
121
143
  headerBackground = theme.assets?.headerBackground;
122
144
  }
123
145
 
@@ -135,27 +157,36 @@ const Screen = forwardRef(
135
157
  <HeaderTitle {...props} animatedValue={animatedValue.current} />
136
158
  ),
137
159
  };
138
- if (animatedHeader.type == 'surface') {
160
+ if (animatedHeader.type === 'surface') {
139
161
  styleAnimatedHeader = {
140
- headerTransparent: true,
162
+ ...styleAnimatedHeader,
141
163
  headerBackground: (props: any) => (
142
164
  <HeaderBackground
143
165
  {...props}
144
166
  image={null}
145
- backgroundColor={theme.colors.background.surface}
146
- useBorder={true}
167
+ useSurface={true}
147
168
  animatedValue={animatedValue.current}
148
169
  />
149
170
  ),
150
171
  };
151
172
  }
173
+ if (animatedHeader.headerTitle) {
174
+ styleAnimatedHeader = {
175
+ ...styleAnimatedHeader,
176
+ headerTitle: (props: any) =>
177
+ animatedHeader.headerTitle?.({
178
+ ...props,
179
+ animatedValue: animatedValue.current,
180
+ }),
181
+ };
182
+ }
152
183
  navigation?.setOptions(styleAnimatedHeader);
153
184
  }
154
185
  }, [animatedHeader]);
155
186
 
156
187
  useEffect(() => {
157
188
  if (!animatedHeader) {
158
- let headerOptions: NavigationOptions = {};
189
+ let headerOptions: NavigationOptions;
159
190
  switch (headerType) {
160
191
  case 'none':
161
192
  headerOptions = {
@@ -171,17 +202,9 @@ const Screen = forwardRef(
171
202
  headerShown: true,
172
203
  headerTintColor: theme.colors.text.default,
173
204
  headerBackground: (props: any) => (
174
- <HeaderBackground
175
- {...props}
176
- image={null}
177
- backgroundColor={theme.colors.background.surface}
178
- useBorder={true}
179
- animatedValue={animatedValue.current}
180
- />
181
- ),
182
- headerTitle: (props: any) => (
183
- <HeaderTitle {...props} animatedValue={animatedValue.current} />
205
+ <HeaderBackground {...props} image={null} useSurface={true} />
184
206
  ),
207
+ headerTitle: (props: any) => <HeaderTitle {...props} />,
185
208
  };
186
209
  break;
187
210
 
@@ -213,8 +236,7 @@ const Screen = forwardRef(
213
236
  if (scrollable) {
214
237
  Component = Animated.ScrollView;
215
238
  handleScroll = scrollViewProps?.onScroll;
216
- if (animatedHeader) {
217
- animatedValue.current = new Animated.Value(0);
239
+ if (animatedHeader || floatingButtonProps?.icon) {
218
240
  handleScroll = Animated.event(
219
241
  [
220
242
  {
@@ -226,22 +248,22 @@ const Screen = forwardRef(
226
248
  {
227
249
  useNativeDriver: true,
228
250
  listener: (e: NativeSyntheticEvent<NativeScrollEvent>) => {
229
- if (animatedHeader.type == 'surface') {
251
+ scrollViewProps?.onScroll?.(e);
252
+ if (animatedHeader?.type === 'surface') {
230
253
  const offsetY = e.nativeEvent.contentOffset.y;
231
254
  let color = Colors.black_01;
232
255
  if (offsetY > 50) {
233
256
  color = theme.colors.text.default;
234
257
  }
235
- if (color != currentTint.current) {
258
+ if (color !== currentTint.current) {
236
259
  currentTint.current = color;
237
260
  navigation?.setOptions({
238
261
  headerTintColor: color,
239
262
  });
240
263
  }
241
264
  }
242
- scrollViewProps?.onScroll?.(e);
243
265
  },
244
- },
266
+ }
245
267
  );
246
268
  }
247
269
  }
@@ -265,7 +287,7 @@ const Screen = forwardRef(
265
287
  if (Array.isArray(results)) {
266
288
  return results.map((item, index) => {
267
289
  const space = item?.props?.useMargin === false ? 0 : Spacing.M;
268
- if (item?.type == Fragment) {
290
+ if (item?.type === Fragment) {
269
291
  return renderContent(item?.props?.children);
270
292
  }
271
293
  if (item) {
@@ -275,7 +297,8 @@ const Screen = forwardRef(
275
297
  style={{
276
298
  marginTop: space,
277
299
  flex: item.props?.expanded ? 1 : undefined,
278
- }}>
300
+ }}
301
+ onLayout={item.props?.onLayout}>
279
302
  {item}
280
303
  </View>
281
304
  );
@@ -284,7 +307,7 @@ const Screen = forwardRef(
284
307
  } else {
285
308
  const item: any = children;
286
309
  const space = item?.props?.useMargin === false ? 0 : Spacing.M;
287
- if (item?.type == Fragment) {
310
+ if (item?.type === Fragment) {
288
311
  return renderContent(item?.props?.children);
289
312
  }
290
313
  return (
@@ -293,7 +316,8 @@ const Screen = forwardRef(
293
316
  style={{
294
317
  marginTop: space,
295
318
  flex: item?.props?.expanded ? 1 : undefined,
296
- }}>
319
+ }}
320
+ onLayout={item?.props?.onLayout}>
297
321
  {children}
298
322
  </View>
299
323
  );
@@ -316,12 +340,13 @@ const Screen = forwardRef(
316
340
  <KeyboardAvoidingView
317
341
  style={Styles.flex}
318
342
  enabled={enableKeyboardAvoidingView}
319
- keyboardVerticalOffset={keyboardVerticalOffset}
343
+ keyboardVerticalOffset={keyboardVerticalOffset ?? keyboardOffset}
320
344
  behavior={Platform.select({
321
345
  ios: 'padding',
322
346
  android: undefined,
323
347
  })}>
324
348
  {Header}
349
+
325
350
  <Component
326
351
  {...scrollViewProps}
327
352
  ref={ref}
@@ -332,12 +357,25 @@ const Screen = forwardRef(
332
357
  style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
333
358
  {renderHeader()}
334
359
  </View>
335
- {renderContent(children)}
360
+ {useGridLayout ? renderContent(children) : children}
336
361
  </Component>
362
+
363
+ {floatingButtonProps && (
364
+ <View>
365
+ <FloatingButton
366
+ {...floatingButtonProps}
367
+ animatedValue={animatedValue.current}
368
+ bottom={
369
+ Footer || isTab ? 12 : Math.min(insets.bottom, 21) + Spacing.S
370
+ }
371
+ />
372
+ </View>
373
+ )}
374
+
337
375
  {Footer && (
338
376
  <View
339
377
  style={[
340
- styles.footerContainer,
378
+ styles.shadow,
341
379
  {
342
380
  paddingBottom: Math.min(insets.bottom, 21) + Spacing.S,
343
381
  backgroundColor: theme.colors.background.surface,
@@ -349,7 +387,7 @@ const Screen = forwardRef(
349
387
  </KeyboardAvoidingView>
350
388
  </View>
351
389
  );
352
- },
390
+ }
353
391
  );
354
392
 
355
393
  export default Screen;
@@ -85,7 +85,7 @@ const Section: React.FC<SectionProps> = ({
85
85
  {rows.map((i: React.ReactElement, index: number) => {
86
86
  return (
87
87
  <View key={`Card${cursor}${index}`} style={{flexDirection: 'row'}}>
88
- {index != 0 && (
88
+ {index !== 0 && (
89
89
  <View style={{width: gridContext.gutterSize}}></View>
90
90
  )}
91
91
  {i}
@@ -125,14 +125,14 @@ const Section: React.FC<SectionProps> = ({
125
125
  rows = [item];
126
126
  }
127
127
 
128
- if (i == arrayChild.length - 1) {
128
+ if (i === arrayChild.length - 1) {
129
129
  cursor += 1;
130
130
  element.push(addRowView(rows, cursor, true));
131
131
  }
132
132
  }
133
133
  } else {
134
134
  element.push(children);
135
- if (children?.type == Fragment) {
135
+ if (children?.type === Fragment) {
136
136
  return renderView(children?.props.children);
137
137
  }
138
138
  }
@@ -151,6 +151,7 @@ const Section: React.FC<SectionProps> = ({
151
151
  }}>
152
152
  <View
153
153
  {...props}
154
+ onLayout={undefined}
154
155
  style={[
155
156
  style,
156
157
  styles.protectedStyle,
package/Layout/styles.ts CHANGED
@@ -80,17 +80,21 @@ export default StyleSheet.create({
80
80
  paddingHorizontal: undefined,
81
81
  paddingVertical: undefined,
82
82
  },
83
- footerContainer: {
83
+ shadow: {
84
84
  paddingTop: Spacing.S,
85
85
  ...Platform.select({
86
- android: {
87
- elevation: 4,
88
- },
89
86
  ios: {
87
+ shadowColor: Colors.black_17,
88
+ shadowOffset: {
89
+ width: 2,
90
+ height: 2,
91
+ },
92
+ shadowOpacity: 0.25,
93
+ shadowRadius: 10,
94
+ },
95
+ android: {
90
96
  shadowColor: Colors.black_20,
91
- shadowOffset: {width: 0, height: -2},
92
- shadowOpacity: 0.1,
93
- shadowRadius: 3,
97
+ elevation: 24,
94
98
  },
95
99
  }),
96
100
  },
package/Layout/utils.ts CHANGED
@@ -1,5 +1,5 @@
1
- import {Dimensions} from 'react-native';
2
1
  import React, {Fragment, ReactElement, useEffect, useState} from 'react';
2
+ import {Dimensions} from 'react-native';
3
3
 
4
4
  /**
5
5
  * validate children type
@@ -12,7 +12,7 @@ const validateChildren = (
12
12
  ) => {
13
13
  const validateType = (child: React.ReactElement) => {
14
14
  const valid = childrenTypes.some(
15
- childrenType => child?.type === childrenType || child?.type == Fragment,
15
+ childrenType => child?.type === childrenType || child?.type === Fragment,
16
16
  );
17
17
  if (!valid) {
18
18
  console.warn(
@@ -42,7 +42,7 @@ const useGridSystem = () => {
42
42
  useEffect(() => {
43
43
  const subscription: any = Dimensions.addEventListener('change', () => {
44
44
  const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
45
- if (newColumns != numberOfColumns) {
45
+ if (newColumns !== numberOfColumns) {
46
46
  setNumberOfColumns(newColumns);
47
47
  }
48
48
  });
@@ -52,4 +52,4 @@ const useGridSystem = () => {
52
52
  return {numberOfColumns};
53
53
  };
54
54
 
55
- export {validateChildren, useGridSystem};
55
+ export {useGridSystem, validateChildren};
package/Loader/index.tsx CHANGED
@@ -1,4 +1,6 @@
1
1
  import Loader from './Loader';
2
2
  import ProgressBar from './ProgressBar';
3
+ import {LoaderProps, ProgressBarProps} from './types';
3
4
 
4
5
  export {Loader, ProgressBar};
6
+ export type {LoaderProps, ProgressBarProps};
@@ -1,12 +1,12 @@
1
1
  import React, {useContext, useEffect, useRef, useState} from 'react';
2
2
  import {ScrollView, StyleSheet, TouchableOpacity, View} from 'react-native';
3
- import {PopupNotifyProps} from './types';
4
- import {Radius, Spacing, Styles} from '../Consts';
5
- import {Image} from '../Image';
6
- import {Text} from '../Text';
7
3
  import {ApplicationContext, MiniAppContext} from '../Application';
8
4
  import {Button} from '../Button';
5
+ import {Radius, Spacing, Styles} from '../Consts';
9
6
  import {Icon} from '../Icon';
7
+ import {Image} from '../Image';
8
+ import {scaleSize, Text} from '../Text';
9
+ import {PopupNotifyProps} from './types';
10
10
 
11
11
  const PopupNotify: React.FC<PopupNotifyProps> = ({
12
12
  id,
@@ -19,18 +19,16 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
19
19
  buttonDirection = 'row',
20
20
  onIconClose,
21
21
  }) => {
22
- const context = useContext(MiniAppContext);
22
+ const context = useContext<any>(MiniAppContext);
23
23
  const {theme, navigator, translate} = useContext(ApplicationContext);
24
24
  const [scrollContent, setScrollContent] = useState(false);
25
25
  const closeAction = useRef('touch_outside');
26
-
27
26
  let descriptionStyle = {};
28
27
  let Description: any = View;
29
28
  if (scrollContent) {
30
29
  Description = ScrollView;
31
- descriptionStyle = {height: 80};
30
+ descriptionStyle = {maxHeight: scaleSize(172)};
32
31
  }
33
-
34
32
  /**
35
33
  * tracking
36
34
  */
@@ -42,7 +40,8 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
42
40
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
43
41
  }
44
42
  const tracking = {
45
- ...context,
43
+ appId: context.appId,
44
+ code: context.code,
46
45
  screen_name,
47
46
  component_type: 'popup',
48
47
  component_name: id,
@@ -89,6 +88,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
89
88
  closeAction.current = 'button_action';
90
89
  onAction(secondary?.onPress);
91
90
  }}
91
+ accessibilityLabel={'btn_popup_cancel'}
92
92
  />
93
93
  </View>
94
94
  <View style={styles.buttonSpace} />
@@ -102,6 +102,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
102
102
  closeAction.current = 'button_action';
103
103
  onAction(primary.onPress);
104
104
  }}
105
+ accessibilityLabel={'btn_popup_allow'}
105
106
  />
106
107
  </View>
107
108
  </View>
@@ -111,6 +112,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
111
112
  return (
112
113
  <View style={Styles.columnCenter}>
113
114
  <Button
115
+ accessibilityLabel={'btn_popup_allow'}
114
116
  title={primary.title}
115
117
  size="medium"
116
118
  onPress={() => {
@@ -122,6 +124,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
122
124
  <>
123
125
  <View style={styles.buttonSpace} />
124
126
  <Button
127
+ accessibilityLabel={'btn_popup_cancel'}
125
128
  title={secondary?.title}
126
129
  type="text"
127
130
  size="medium"
@@ -136,7 +139,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
136
139
  );
137
140
  };
138
141
 
139
- if (buttonDirection == 'auto') {
142
+ if (buttonDirection === 'auto') {
140
143
  if (
141
144
  secondary?.title &&
142
145
  (secondary.title.length > 12 || primary.title.length > 12)
@@ -145,7 +148,7 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
145
148
  }
146
149
  return renderRow();
147
150
  }
148
- if (buttonDirection == 'row') {
151
+ if (buttonDirection === 'row') {
149
152
  return renderRow();
150
153
  }
151
154
  return renderColumn();
@@ -155,33 +158,37 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
155
158
  * build close action
156
159
  */
157
160
  const buildCloseIcon = () => {
158
- return (
159
- <TouchableOpacity
160
- style={styles.iconCloseContainer}
161
- onPress={() => {
162
- closeAction.current = 'icon_close';
163
- onAction(onIconClose);
164
- }}>
165
- <View
166
- style={[
167
- styles.iconClose,
168
- {
169
- backgroundColor: theme.colors.text.default,
170
- borderColor: theme.colors.background.surface,
171
- },
172
- ]}>
173
- <Icon
174
- source="navigation_close"
175
- color={theme.colors.background.surface}
176
- size={14}
177
- />
178
- </View>
179
- </TouchableOpacity>
180
- );
161
+ if (typeof onIconClose === 'function') {
162
+ return (
163
+ <TouchableOpacity
164
+ accessibilityLabel={'ic_popup_close'}
165
+ style={styles.iconCloseContainer}
166
+ onPress={() => {
167
+ closeAction.current = 'icon_close';
168
+ onAction(onIconClose);
169
+ }}>
170
+ <View
171
+ style={[
172
+ styles.iconClose,
173
+ {
174
+ backgroundColor: theme.colors.text.default,
175
+ borderColor: theme.colors.background.surface,
176
+ },
177
+ ]}>
178
+ <Icon
179
+ source="navigation_close"
180
+ color={theme.colors.background.surface}
181
+ size={14}
182
+ />
183
+ </View>
184
+ </TouchableOpacity>
185
+ );
186
+ }
181
187
  };
182
188
 
183
189
  return (
184
190
  <View
191
+ accessibilityLabel={'popup_notify'}
185
192
  style={[
186
193
  styles.container,
187
194
  {backgroundColor: theme.colors.background.surface},
@@ -192,16 +199,20 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
192
199
  {title}
193
200
  </Text>
194
201
  <Description style={[styles.description, descriptionStyle]}>
195
- <Text
196
- typography={'body_default_regular'}
197
- onTextLayout={({nativeEvent: {lines}}) => {
198
- const enableScroll = lines.length > 3;
199
- if (enableScroll != scrollContent) {
200
- setScrollContent(enableScroll);
201
- }
202
- }}>
203
- {description}
204
- </Text>
202
+ {typeof description === 'string' ? (
203
+ <Text
204
+ typography={'body_default_regular'}
205
+ onTextLayout={({nativeEvent: {lines}}) => {
206
+ const enableScroll = lines.length > 3;
207
+ if (enableScroll !== scrollContent) {
208
+ setScrollContent(enableScroll);
209
+ }
210
+ }}>
211
+ {description}
212
+ </Text>
213
+ ) : (
214
+ description
215
+ )}
205
216
  </Description>
206
217
  {!!error && (
207
218
  <View style={styles.information}>
@@ -11,7 +11,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
11
11
  image,
12
12
  onIconClose,
13
13
  }) => {
14
- const context = useContext(MiniAppContext);
14
+ const context = useContext<any>(MiniAppContext);
15
15
  const {theme, navigator} = useContext(ApplicationContext);
16
16
  const closeAction = useRef('touch_outside');
17
17
 
@@ -26,7 +26,8 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
26
26
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
27
27
  }
28
28
  const tracking = {
29
- ...context,
29
+ appId: context.appId,
30
+ code: context.code,
30
31
  screen_name,
31
32
  component_type: 'popup',
32
33
  component_name: id,
@@ -51,6 +52,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
51
52
  return (
52
53
  <View style={styles.iconCloseContainer}>
53
54
  <TouchableOpacity
55
+ accessibilityLabel={'ic_popup_close'}
54
56
  onPress={() => {
55
57
  closeAction.current = 'icon_close';
56
58
  navigator?.pop();
@@ -77,7 +79,7 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
77
79
  };
78
80
 
79
81
  return (
80
- <View>
82
+ <View accessibilityLabel={'popup_promotion'}>
81
83
  <Image
82
84
  source={{
83
85
  uri: image,
@@ -113,8 +115,4 @@ const styles = StyleSheet.create({
113
115
  },
114
116
  });
115
117
 
116
- PopupPromotion.defaultProps = {
117
- image: 'https://google.com',
118
- };
119
-
120
118
  export default PopupPromotion;
package/Popup/types.ts CHANGED
@@ -1,4 +1,3 @@
1
- import {TextStyle} from 'react-native';
2
1
  import React from 'react';
3
2
 
4
3
  export type PopupNotifyProps = {
@@ -19,7 +18,7 @@ export type PopupNotifyProps = {
19
18
  /**
20
19
  * `description`: Represents the description text to be displayed in the PopupNotify component.
21
20
  */
22
- description: string | React.ReactNode;
21
+ description?: string | React.ReactNode;
23
22
 
24
23
  /**
25
24
  * `error`: Optional. Represents additional error text to be displayed in the PopupNotify component.
@@ -79,9 +78,4 @@ type PopupAction = {
79
78
  onPress: () => void;
80
79
  };
81
80
 
82
- export type HighlightText = {
83
- text: string;
84
- style: TextStyle;
85
- };
86
-
87
81
  type PopupActionDirection = 'row' | 'column' | 'auto';