@momo-kits/foundation 0.92.2 → 0.92.3-tracking.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.
package/Image/index.tsx CHANGED
@@ -1,8 +1,8 @@
1
- import React, {useContext, useRef, useState} from 'react';
1
+ import React, {useContext, useEffect, useRef, useState} from 'react';
2
2
  import {StyleSheet, View} from 'react-native';
3
3
  import FastImage, {Source} from 'react-native-fast-image';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Application';
5
+ import {ApplicationContext, ComponentContext} from '../Application';
6
6
  import {Skeleton} from '../Skeleton';
7
7
  import {Icon} from '../Icon';
8
8
  import {Styles} from '../Consts';
@@ -14,14 +14,25 @@ type Status = 'success' | 'loading' | 'error';
14
14
  const Image: React.FC<ImageProps> = ({
15
15
  style,
16
16
  source,
17
- loading,
17
+ loading = true,
18
18
  children,
19
+ accessibilityLabel,
19
20
  ...rest
20
21
  }) => {
21
22
  const {theme} = useContext(ApplicationContext);
23
+ const component = useContext<any>(ComponentContext);
22
24
  const error = useRef(false);
23
25
  const [status, setStatus] = useState<Status>('success');
24
26
 
27
+ const id = getAccessibilityID(
28
+ `img|${(source as Source).uri}`,
29
+ accessibilityLabel,
30
+ );
31
+
32
+ useEffect(() => {
33
+ component?.addChild?.(id.testID || id.accessibilityLabel);
34
+ }, []);
35
+
25
36
  /**
26
37
  * render content loading | fail | rendered
27
38
  */
@@ -45,7 +56,7 @@ const Image: React.FC<ImageProps> = ({
45
56
  return (
46
57
  <FastImage
47
58
  {...rest}
48
- {...getAccessibilityID(`img|${(source as Source).uri}`)}
59
+ {...id}
49
60
  source={source}
50
61
  style={[styles.container, style]}
51
62
  onProgress={() => {
@@ -77,8 +88,4 @@ const Image: React.FC<ImageProps> = ({
77
88
  );
78
89
  };
79
90
 
80
- Image.defaultProps = {
81
- loading: true,
82
- };
83
-
84
91
  export {Image};
package/Image/types.ts CHANGED
@@ -2,4 +2,5 @@ import {FastImageProps} from 'react-native-fast-image';
2
2
 
3
3
  export interface ImageProps extends FastImageProps {
4
4
  loading?: boolean;
5
+ accessibilityLabel?: string;
5
6
  }
package/Input/Input.tsx CHANGED
@@ -7,23 +7,14 @@ import {
7
7
  TouchableOpacity,
8
8
  View,
9
9
  } from 'react-native';
10
- import {ApplicationContext} from '../Application';
10
+ import {ApplicationContext, ComponentContext} from '../Application';
11
11
  import styles from './styles';
12
12
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
13
13
  import {InputProps} from './index';
14
14
  import {Icon} from '../Icon';
15
15
  import {checkTyping} from './utils';
16
16
  import {Loader} from '../Loader';
17
- import {
18
- formatComponentName,
19
- getAccessibilityID,
20
- cleanNameForTracking,
21
- } from '../Application/utils';
22
-
23
- const {
24
- ScreenContext,
25
- MiniAppContext,
26
- } = require('react-native/Libraries/Components/ScreenContext');
17
+ import {formatComponentName} from '../Application/utils';
27
18
 
28
19
  const Input = forwardRef(
29
20
  (
@@ -52,18 +43,16 @@ const Input = forwardRef(
52
43
  keyboardType,
53
44
  style,
54
45
  params,
55
- componentId,
46
+ accessibilityLabel,
56
47
  ...props
57
48
  }: InputProps,
58
49
  ref,
59
50
  ) => {
60
51
  const {theme} = useContext(ApplicationContext);
61
- const {appId, code} = useContext<any>(MiniAppContext);
62
52
  const [focused, setFocused] = useState(false);
63
53
  const [haveValue, setHaveValue] = useState(!!value || !!props.defaultValue);
64
54
  const [secureTextInput, setSecureTextInput] = useState(secureTextEntry);
65
55
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
66
- const screenInfo = useContext<any>(ScreenContext);
67
56
 
68
57
  const onClearText = () => {
69
58
  inputRef?.current?.clear();
@@ -122,21 +111,6 @@ const Input = forwardRef(
122
111
  let textColor = theme.colors.text.default;
123
112
  let placeholderColor = theme.colors.text.hint;
124
113
  let iconTintColor = iconColor;
125
- const accessibilityID = disabled
126
- ? getAccessibilityID(
127
- `${appId}/${code}/${
128
- screenInfo.screenName
129
- }/input_${cleanNameForTracking(
130
- floatingValue ?? placeholder,
131
- )}_disabled`,
132
- )
133
- : getAccessibilityID(
134
- `${appId}/${code}/${
135
- screenInfo.screenName
136
- }/input_${cleanNameForTracking(
137
- floatingValue ?? placeholder ?? value,
138
- )}`,
139
- );
140
114
 
141
115
  if (disabled) {
142
116
  textColor = disabledColor;
@@ -178,7 +152,7 @@ const Input = forwardRef(
178
152
  )}
179
153
  <TextInput
180
154
  {...props}
181
- {...accessibilityID}
155
+ accessibilityLabel={accessibilityLabel}
182
156
  editable={props.editable && !disabled}
183
157
  secureTextEntry={secure}
184
158
  textAlignVertical="center"
@@ -234,20 +208,19 @@ const Input = forwardRef(
234
208
  }
235
209
 
236
210
  return (
237
- <ScreenContext.Provider
211
+ <ComponentContext.Provider
238
212
  value={{
239
- ...screenInfo,
240
213
  componentName: 'Input',
241
214
  params,
242
215
  componentLabel: formatComponentName(floatingValue || ''),
243
216
  state: inputState,
244
- componentId,
217
+ componentId: accessibilityLabel,
245
218
  }}>
246
219
  <View style={[style, styles.wrapper]}>
247
220
  {renderInputView()}
248
221
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
249
222
  </View>
250
- </ScreenContext.Provider>
223
+ </ComponentContext.Provider>
251
224
  );
252
225
  },
253
226
  );
@@ -1,22 +1,13 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {TextInput, TouchableOpacity, View} from 'react-native';
3
- import {ApplicationContext} from '../Application';
3
+ import {ApplicationContext, ComponentContext} from '../Application';
4
4
  import styles from './styles';
5
5
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
6
6
  import {InputDropDownProps} from './index';
7
7
  import {Icon} from '../Icon';
8
8
  import {Loader} from '../Loader';
9
9
  import {Styles} from '../Consts';
10
- import {
11
- cleanNameForTracking,
12
- formatComponentName,
13
- getAccessibilityID,
14
- } from '../Application/utils';
15
-
16
- const {
17
- ScreenContext,
18
- MiniAppContext,
19
- } = require('react-native/Libraries/Components/ScreenContext');
10
+ import {formatComponentName} from '../Application/utils';
20
11
 
21
12
  const InputDropDown = ({
22
13
  value,
@@ -37,13 +28,11 @@ const InputDropDown = ({
37
28
  leadingIconColor,
38
29
  style,
39
30
  params,
40
- componentId,
31
+ accessibilityLabel,
41
32
  ...props
42
33
  }: InputDropDownProps) => {
43
- const {appId, code} = useContext<any>(MiniAppContext);
44
34
  const {theme} = useContext(ApplicationContext);
45
35
  const full = !!value || !!placeholder;
46
- const screenInfo = useContext<any>(ScreenContext);
47
36
 
48
37
  const renderIcon = (color: string | undefined) => {
49
38
  if (loading) {
@@ -59,19 +48,6 @@ const InputDropDown = ({
59
48
  let textColor = theme.colors.text.default;
60
49
  let placeholderColor = theme.colors.text.hint;
61
50
  let iconTintColor = iconColor;
62
- const accessibilityID = disabled
63
- ? getAccessibilityID(
64
- `${appId}/${code}/${
65
- screenInfo.screenName
66
- }/input_${cleanNameForTracking(
67
- floatingValue ?? placeholder,
68
- )}_disabled`,
69
- )
70
- : getAccessibilityID(
71
- `${appId}/${code}/${
72
- screenInfo.screenName
73
- }/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
74
- );
75
51
 
76
52
  if (disabled) {
77
53
  textColor = disabledColor;
@@ -107,7 +83,7 @@ const InputDropDown = ({
107
83
  {full && (
108
84
  <TextInput
109
85
  {...props}
110
- {...accessibilityID}
86
+ accessibilityLabel={accessibilityLabel}
111
87
  onPressIn={onPress}
112
88
  editable={false}
113
89
  textAlignVertical="top"
@@ -132,14 +108,13 @@ const InputDropDown = ({
132
108
  };
133
109
 
134
110
  return (
135
- <ScreenContext.Provider
111
+ <ComponentContext.Provider
136
112
  value={{
137
- ...screenInfo,
138
113
  componentName: 'InputOTP',
139
114
  params,
140
115
  state: 'enabled',
141
116
  componentLabel: formatComponentName(floatingValue || ''),
142
- componentId,
117
+ componentId: accessibilityLabel,
143
118
  }}>
144
119
  <TouchableOpacity
145
120
  onPress={onPress}
@@ -147,7 +122,7 @@ const InputDropDown = ({
147
122
  {renderInputView()}
148
123
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
149
124
  </TouchableOpacity>
150
- </ScreenContext.Provider>
125
+ </ComponentContext.Provider>
151
126
  );
152
127
  };
153
128
 
@@ -12,22 +12,13 @@ import {
12
12
  TouchableOpacity,
13
13
  View,
14
14
  } from 'react-native';
15
- import {ApplicationContext} from '../Application';
15
+ import {ApplicationContext, ComponentContext} from '../Application';
16
16
  import styles from './styles';
17
17
  import {ErrorView, FloatingView, getBorderColor, getSizeStyle} from './common';
18
18
  import {InputMoneyProps} from './index';
19
19
  import {Icon} from '../Icon';
20
20
  import {formatMoneyToNumber, formatNumberToMoney} from './utils';
21
- import {
22
- cleanNameForTracking,
23
- formatComponentName,
24
- getAccessibilityID,
25
- } from '../Application/utils';
26
-
27
- const {
28
- ScreenContext,
29
- MiniAppContext,
30
- } = require('react-native/Libraries/Components/ScreenContext');
21
+ import {formatComponentName} from '../Application/utils';
31
22
 
32
23
  const InputMoney = forwardRef(
33
24
  (
@@ -48,16 +39,14 @@ const InputMoney = forwardRef(
48
39
  style,
49
40
  params,
50
41
  defaultValue = '',
51
- componentId,
42
+ accessibilityLabel,
52
43
  ...props
53
44
  }: InputMoneyProps,
54
45
  ref,
55
46
  ) => {
56
47
  const {theme} = useContext(ApplicationContext);
57
- const {appId, code} = useContext<any>(MiniAppContext);
58
48
  const [focused, setFocused] = useState(false);
59
49
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
60
- const screenInfo = useContext<any>(ScreenContext);
61
50
 
62
51
  const validateText = (text: string) => {
63
52
  const valueFormat = formatMoneyToNumber(text, 'đ');
@@ -103,17 +92,6 @@ const InputMoney = forwardRef(
103
92
  let textColor = theme.colors.text.default;
104
93
  let placeholderColor = theme.colors.text.hint;
105
94
  let iconTintColor = iconColor;
106
- const accessibilityID = disabled
107
- ? getAccessibilityID(
108
- `${appId}/${code}/${
109
- screenInfo.screenName
110
- }/input_${cleanNameForTracking(floatingValue)}_disabled`,
111
- )
112
- : getAccessibilityID(
113
- `${appId}/${code}/${
114
- screenInfo.screenName
115
- }/input_${cleanNameForTracking(floatingValue)}`,
116
- );
117
95
 
118
96
  if (disabled) {
119
97
  textColor = disabledColor;
@@ -139,7 +117,7 @@ const InputMoney = forwardRef(
139
117
  <View style={styles.inputView}>
140
118
  <TextInput
141
119
  {...props}
142
- {...accessibilityID}
120
+ accessibilityLabel={accessibilityLabel}
143
121
  editable={!disabled}
144
122
  textAlignVertical="top"
145
123
  ref={inputRef}
@@ -191,20 +169,19 @@ const InputMoney = forwardRef(
191
169
  }
192
170
 
193
171
  return (
194
- <ScreenContext.Provider
172
+ <ComponentContext.Provider
195
173
  value={{
196
- ...screenInfo,
197
174
  componentName: 'InputMoney',
198
175
  params,
199
176
  componentLabel: formatComponentName(floatingValue || ''),
200
177
  state: inputState,
201
- componentId,
178
+ componentId: accessibilityLabel,
202
179
  }}>
203
180
  <View style={[style, styles.wrapper]}>
204
181
  {renderInputView()}
205
182
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
206
183
  </View>
207
- </ScreenContext.Provider>
184
+ </ComponentContext.Provider>
208
185
  );
209
186
  },
210
187
  );
@@ -19,18 +19,9 @@ import {CaretProps, InputOTPProps} from './index';
19
19
  import {scaleSize, Text} from '../Text';
20
20
  import styles from './styles';
21
21
  import {ErrorView, getBorderColor} from './common';
22
- import {ApplicationContext} from '../Application';
22
+ import {ApplicationContext, ComponentContext} from '../Application';
23
23
  import {Spacing} from '../Consts';
24
- import {
25
- cleanNameForTracking,
26
- formatComponentName,
27
- getAccessibilityID,
28
- } from '../Application/utils';
29
-
30
- const {
31
- ScreenContext,
32
- MiniAppContext,
33
- } = require('react-native/Libraries/Components/ScreenContext');
24
+ import {formatComponentName} from '../Application/utils';
34
25
 
35
26
  const OTPCaret: FC<CaretProps> = ({index, length}) => {
36
27
  const DURATION = 300;
@@ -90,19 +81,16 @@ const InputOTP = forwardRef(
90
81
  dataType = 'number',
91
82
  params,
92
83
  style,
93
- componentId,
84
+ accessibilityLabel,
94
85
  ...props
95
86
  }: InputOTPProps,
96
87
  ref,
97
88
  ) => {
98
89
  const MAX_LENGTH = 10;
99
- const {appId, code} = useContext<any>(MiniAppContext);
100
-
101
90
  const [value, setValue] = useState('');
102
91
  const [focused, setFocused] = useState(false);
103
92
  const inputRef = useRef<TextInput>(null);
104
93
  const {theme} = useContext(ApplicationContext);
105
- const screenInfo = useContext<any>(ScreenContext);
106
94
 
107
95
  useImperativeHandle(ref, () => ({
108
96
  onChangeText: (text: string) => {
@@ -195,12 +183,6 @@ const InputOTP = forwardRef(
195
183
  );
196
184
  };
197
185
 
198
- const accessibilityID = getAccessibilityID(
199
- `${appId}/${code}/${screenInfo.screenName}/input_${cleanNameForTracking(
200
- floatingValue,
201
- )}`,
202
- );
203
-
204
186
  const renderInputView = () => {
205
187
  return (
206
188
  <View
@@ -226,7 +208,7 @@ const InputOTP = forwardRef(
226
208
  <View style={styles.inputView}>
227
209
  <TextInput
228
210
  {...props}
229
- {...accessibilityID}
211
+ accessibilityLabel={accessibilityLabel}
230
212
  ref={inputRef}
231
213
  value={value}
232
214
  onChangeText={_onChangeText}
@@ -243,14 +225,13 @@ const InputOTP = forwardRef(
243
225
  };
244
226
 
245
227
  return (
246
- <ScreenContext.Provider
228
+ <ComponentContext.Provider
247
229
  value={{
248
- ...screenInfo,
249
230
  componentName: 'InputOTP',
250
231
  params,
251
232
  componentLabel: formatComponentName(floatingValue || ''),
252
233
  state: 'enabled',
253
- componentId,
234
+ componentId: accessibilityLabel,
254
235
  }}>
255
236
  <TouchableOpacity
256
237
  activeOpacity={1}
@@ -259,7 +240,7 @@ const InputOTP = forwardRef(
259
240
  {renderInputView()}
260
241
  <ErrorView errorMessage={errorMessage} errorSpacing={errorSpacing} />
261
242
  </TouchableOpacity>
262
- </ScreenContext.Provider>
243
+ </ComponentContext.Provider>
263
244
  );
264
245
  },
265
246
  );
@@ -7,17 +7,11 @@ import {
7
7
  View,
8
8
  } from 'react-native';
9
9
  import {InputSearchProps} from './index';
10
- import {ApplicationContext} from '../Application';
10
+ import {ApplicationContext, ComponentContext} from '../Application';
11
11
  import styles from './styles';
12
12
  import {Icon} from '../Icon';
13
13
  import {Text} from '../Text';
14
14
  import {checkTyping} from './utils';
15
- import {getAccessibilityID} from '../Application/utils';
16
-
17
- const {
18
- ScreenContext,
19
- MiniAppContext,
20
- } = require('react-native/Libraries/Components/ScreenContext');
21
15
 
22
16
  const InputSearch = forwardRef(
23
17
  (
@@ -35,18 +29,16 @@ const InputSearch = forwardRef(
35
29
  defaultValue,
36
30
  onPressButtonText,
37
31
  params,
38
- componentId,
39
32
  hasColorBG = false,
33
+ accessibilityLabel,
40
34
  ...props
41
35
  }: InputSearchProps,
42
36
  ref,
43
37
  ) => {
44
38
  const {theme} = useContext(ApplicationContext);
45
- const {appId, code} = useContext<any>(MiniAppContext);
46
39
  const [focused, setFocused] = useState(false);
47
40
  const [haveValue, setHaveValue] = useState(!!value || !!defaultValue);
48
41
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
49
- const screenInfo = useContext<any>(ScreenContext);
50
42
 
51
43
  const _onFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
52
44
  setFocused(true);
@@ -72,9 +64,7 @@ const InputSearch = forwardRef(
72
64
  return (
73
65
  <TextInput
74
66
  {...props}
75
- {...getAccessibilityID(
76
- `${appId}/${code}/${screenInfo.screenName}/input_search`,
77
- )}
67
+ accessibilityLabel={accessibilityLabel}
78
68
  textAlignVertical="center"
79
69
  ref={inputRef}
80
70
  style={[
@@ -145,13 +135,12 @@ const InputSearch = forwardRef(
145
135
  : theme.colors.background.surface;
146
136
 
147
137
  return (
148
- <ScreenContext.Provider
138
+ <ComponentContext.Provider
149
139
  value={{
150
- ...screenInfo,
151
140
  componentName: 'InputSearch',
152
141
  params,
153
142
  state: inputState,
154
- componentId,
143
+ componentId: accessibilityLabel,
155
144
  }}>
156
145
  <View style={[style, styles.searchInputContainer]}>
157
146
  <View
@@ -179,7 +168,7 @@ const InputSearch = forwardRef(
179
168
  </TouchableOpacity>
180
169
  )}
181
170
  </View>
182
- </ScreenContext.Provider>
171
+ </ComponentContext.Provider>
183
172
  );
184
173
  },
185
174
  );
@@ -18,12 +18,6 @@ import {
18
18
  import {InputTextAreaProps} from './index';
19
19
  import {Icon} from '../Icon';
20
20
  import {ApplicationContext} from '../Application';
21
- import {cleanNameForTracking, getAccessibilityID} from '../Application/utils';
22
-
23
- const {
24
- ScreenContext,
25
- MiniAppContext,
26
- } = require('react-native/Libraries/Components/ScreenContext');
27
21
 
28
22
  const InputTextArea = forwardRef(
29
23
  (
@@ -44,13 +38,12 @@ const InputTextArea = forwardRef(
44
38
  required,
45
39
  errorSpacing,
46
40
  style,
41
+ accessibilityLabel,
47
42
  ...props
48
43
  }: InputTextAreaProps,
49
44
  ref,
50
45
  ) => {
51
46
  const {theme} = useContext(ApplicationContext);
52
- const screenInfo = useContext<any>(ScreenContext);
53
- const {appId, code} = useContext<any>(MiniAppContext);
54
47
  const [focused, setFocused] = useState(false);
55
48
  const [inputValue, setInputValue] = useState(defaultValue ?? '');
56
49
  const inputRef = (ref as React.RefObject<TextInput>) ?? useRef<TextInput>();
@@ -96,20 +89,6 @@ const InputTextArea = forwardRef(
96
89
  placeholderColor = disabledColor;
97
90
  }
98
91
 
99
- const accessibilityID = disabled
100
- ? getAccessibilityID(
101
- `${appId}/${code}/${
102
- screenInfo.screenName
103
- }/input_${cleanNameForTracking(
104
- floatingValue ?? placeholder,
105
- )}_disabled`,
106
- )
107
- : getAccessibilityID(
108
- `${appId}/${code}/${
109
- screenInfo.screenName
110
- }/input_${cleanNameForTracking(floatingValue ?? placeholder)}`,
111
- );
112
-
113
92
  return (
114
93
  <View
115
94
  style={[
@@ -131,7 +110,6 @@ const InputTextArea = forwardRef(
131
110
  <View style={styles.textAreaView}>
132
111
  <TextInput
133
112
  {...props}
134
- {...accessibilityID}
135
113
  ref={inputRef}
136
114
  editable={!disabled}
137
115
  textAlignVertical="top"
package/Input/index.tsx CHANGED
@@ -82,7 +82,6 @@ export interface InputProps extends TextInputProps {
82
82
  onPressIcon?: () => void;
83
83
 
84
84
  params?: any;
85
- componentId?: string;
86
85
  }
87
86
 
88
87
  type InputPropsWithoutSizeAndIcon = Omit<
@@ -130,8 +129,6 @@ export interface InputSearchProps extends TextInputProps {
130
129
  hasColorBG?: boolean;
131
130
 
132
131
  params?: any;
133
-
134
- componentId?: string;
135
132
  }
136
133
 
137
134
  export interface InputMoneyProps extends InputPropsWithoutPlaceholder {}
@@ -169,7 +166,7 @@ export type CaretProps = {
169
166
  length?: number;
170
167
  };
171
168
 
172
- export interface InputDropDownProps {
169
+ export interface InputDropDownProps extends InputProps {
173
170
  /**
174
171
  * Optional. Defines the size of the InputDropDown component.
175
172
  * 'small' - A smaller, less prominent input.
@@ -264,11 +261,6 @@ export interface InputDropDownProps {
264
261
  [key: string]: any;
265
262
  };
266
263
 
267
- /**
268
- * component id for element tracking.
269
- */
270
- componentId?: string;
271
-
272
264
  /**
273
265
  * Optional. Represents the style of the InputDropDown component.
274
266
  */
@@ -4,15 +4,11 @@ import {PopupNotifyProps} from './types';
4
4
  import {Radius, Spacing, Styles} from '../Consts';
5
5
  import {Image} from '../Image';
6
6
  import {Text} from '../Text';
7
- import {ApplicationContext} from '../Application';
7
+ import {ApplicationContext, MiniAppContext} from '../Application';
8
8
  import {Button} from '../Button';
9
9
  import {Icon} from '../Icon';
10
10
  import {getAccessibilityID} from '../Application/utils';
11
11
 
12
- const {
13
- MiniAppContext,
14
- } = require('react-native/Libraries/Components/ScreenContext');
15
-
16
12
  const PopupNotify: React.FC<PopupNotifyProps> = ({
17
13
  id,
18
14
  image,
@@ -47,7 +43,8 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
47
43
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
48
44
  }
49
45
  const tracking = {
50
- ...context,
46
+ appId: context.appId,
47
+ code: context.code,
51
48
  screen_name,
52
49
  component_type: 'popup',
53
50
  component_name: id,
@@ -1,16 +1,12 @@
1
1
  import React, {useContext, useEffect, useRef} from 'react';
2
2
  import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
3
  import {PopupPromotionProps} from './types';
4
- import {ApplicationContext} from '../Application';
4
+ import {ApplicationContext, MiniAppContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
8
8
  import {getAccessibilityID} from '../Application/utils';
9
9
 
10
- const {
11
- MiniAppContext,
12
- } = require('react-native/Libraries/Components/ScreenContext');
13
-
14
10
  const PopupPromotion: React.FC<PopupPromotionProps> = ({
15
11
  id,
16
12
  image,
@@ -31,7 +27,8 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
31
27
  screen_name = routes[routesLength - 2]?.params?.screen?.name;
32
28
  }
33
29
  const tracking = {
34
- ...context,
30
+ appId: context.appId,
31
+ code: context.code,
35
32
  screen_name,
36
33
  component_type: 'popup',
37
34
  component_name: id,
@@ -120,8 +117,4 @@ const styles = StyleSheet.create({
120
117
  },
121
118
  });
122
119
 
123
- PopupPromotion.defaultProps = {
124
- image: 'https://google.com',
125
- };
126
-
127
120
  export default PopupPromotion;