@momo-kits/foundation 0.151.1-test.5 → 0.151.1-tracking.3
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/Application/StackScreen.tsx +43 -21
- package/package.json +34 -34
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
-
import { Alert, InteractionManager } from 'react-native';
|
|
2
|
+
import { Alert, AppState, InteractionManager } from 'react-native';
|
|
3
3
|
import { useHeaderHeight } from '@react-navigation/elements';
|
|
4
4
|
import { ScreenTrackingParams } from './types';
|
|
5
5
|
import Navigation from './Navigation';
|
|
@@ -48,6 +48,24 @@ const StackScreen: React.FC<any> = props => {
|
|
|
48
48
|
} = props.route.params;
|
|
49
49
|
const navigation = useRef(new Navigation(props.navigation, context)).current;
|
|
50
50
|
const heightHeader = useHeaderHeight();
|
|
51
|
+
const appState = useRef(AppState.currentState);
|
|
52
|
+
let isBackgroundToForeground = useRef(false);
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
const subscription = AppState.addEventListener('change', nextAppState => {
|
|
56
|
+
if (
|
|
57
|
+
appState.current.match(/inactive|background/) &&
|
|
58
|
+
nextAppState === 'active'
|
|
59
|
+
) {
|
|
60
|
+
isBackgroundToForeground.current = true;
|
|
61
|
+
}
|
|
62
|
+
appState.current = nextAppState;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return () => {
|
|
66
|
+
subscription.remove();
|
|
67
|
+
};
|
|
68
|
+
}, []);
|
|
51
69
|
|
|
52
70
|
const data = {
|
|
53
71
|
...initialParams,
|
|
@@ -140,29 +158,33 @@ const StackScreen: React.FC<any> = props => {
|
|
|
140
158
|
}, []);
|
|
141
159
|
|
|
142
160
|
const onScreenNavigated = (pre: string, current: string) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
161
|
+
if (!isBackgroundToForeground) {
|
|
162
|
+
const item: any = {
|
|
163
|
+
preScreenName: pre,
|
|
164
|
+
screenName: current,
|
|
165
|
+
componentName: 'Screen',
|
|
166
|
+
state: 'navigated',
|
|
167
|
+
action: tracking.current?.mounted ? 'back' : 'push',
|
|
168
|
+
};
|
|
150
169
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
170
|
+
context?.autoTracking?.({
|
|
171
|
+
...context,
|
|
172
|
+
...item,
|
|
173
|
+
});
|
|
155
174
|
|
|
156
|
-
|
|
175
|
+
tracking.current.mounted = true;
|
|
157
176
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
177
|
+
/**
|
|
178
|
+
* debug toast
|
|
179
|
+
*/
|
|
180
|
+
navigator?.maxApi?.showToastDebug?.({
|
|
181
|
+
appId: context.appId,
|
|
182
|
+
message: `${screenName} screen_navigated`,
|
|
183
|
+
type: 'ERROR',
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (isBackgroundToForeground) isBackgroundToForeground.current = false;
|
|
166
188
|
};
|
|
167
189
|
|
|
168
190
|
/**
|
package/package.json
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
2
|
+
"name": "@momo-kits/foundation",
|
|
3
|
+
"version": "0.151.1-tracking.3",
|
|
4
|
+
"description": "React Native Component Kits",
|
|
5
|
+
"main": "index.ts",
|
|
6
|
+
"scripts": {},
|
|
7
|
+
"keywords": [
|
|
8
|
+
"@momo-kits/foundation"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"react-native-fast-image": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-fast-image.git#v8.11.0",
|
|
12
|
+
"@react-navigation/bottom-tabs": "7.4.2",
|
|
13
|
+
"@react-navigation/core": "7.12.1",
|
|
14
|
+
"@react-navigation/elements": "2.5.2",
|
|
15
|
+
"@react-navigation/native": "7.1.14",
|
|
16
|
+
"@react-navigation/routers": "7.4.1",
|
|
17
|
+
"@react-navigation/stack": "7.4.2",
|
|
18
|
+
"react-native-gesture-handler": "2.27.1",
|
|
19
|
+
"react-native-linear-gradient": "git+https://oauth2:TGi6oBj-LdzsKpLXQSoH@gitlab.mservice.com.vn/momo-platform/public/react-native-linear-gradient#v3.0.0",
|
|
20
|
+
"react-native-reanimated": "4.1.0",
|
|
21
|
+
"react-native-safe-area-context": "5.5.2",
|
|
22
|
+
"@shopify/flash-list": "2.1.0"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react-native": "*"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@momo-platform/versions": "4.1.11",
|
|
29
|
+
"@types/color": "3.0.6"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
34
|
+
"license": "MoMo"
|
|
35
|
+
}
|