@momo-kits/foundation 0.92.29-optimize.5 → 0.92.29-optimize.7
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/Components.tsx +2 -10
- package/Application/Navigator.ts +5 -7
- package/Application/StackScreen.tsx +19 -4
- package/Input/common.tsx +0 -1
- package/package.json +1 -1
- package/publish.sh +6 -6
|
@@ -333,15 +333,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
333
333
|
|
|
334
334
|
const onMore = () => {
|
|
335
335
|
onAction?.('onMore');
|
|
336
|
-
navigator?.maxApi?.dispatchFunction?.(
|
|
337
|
-
'showTools',
|
|
338
|
-
{runtimeTools},
|
|
339
|
-
(res: {item: {action?: string; key: string}}) => {
|
|
340
|
-
const {item} = res;
|
|
341
|
-
navigator?.toolkitCallback?.(item.key);
|
|
342
|
-
getToolkitConfig();
|
|
343
|
-
}
|
|
344
|
-
);
|
|
336
|
+
navigator?.maxApi?.dispatchFunction?.('showToolkit', [undefined], () => {});
|
|
345
337
|
};
|
|
346
338
|
|
|
347
339
|
const onClose = () => {
|
|
@@ -385,7 +377,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
385
377
|
onPress={() => {
|
|
386
378
|
navigator?.maxApi?.dispatchFunction?.(
|
|
387
379
|
'onToolAction',
|
|
388
|
-
|
|
380
|
+
{item: pinTool},
|
|
389
381
|
() => {
|
|
390
382
|
getToolkitConfig();
|
|
391
383
|
}
|
package/Application/Navigator.ts
CHANGED
|
@@ -12,7 +12,7 @@ class Navigator {
|
|
|
12
12
|
toolkitConfig?: HeaderToolkitProps;
|
|
13
13
|
maxApi?: any;
|
|
14
14
|
dismissData?: any;
|
|
15
|
-
toolkitCallback?: (
|
|
15
|
+
toolkitCallback?: (key: string) => void;
|
|
16
16
|
|
|
17
17
|
constructor(navigation: any, isReady: any) {
|
|
18
18
|
this.ref = navigation;
|
|
@@ -78,7 +78,7 @@ class Navigator {
|
|
|
78
78
|
StackActions.push('Modal', {
|
|
79
79
|
...params,
|
|
80
80
|
isBottomSheet: true,
|
|
81
|
-
})
|
|
81
|
+
})
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
@@ -103,7 +103,7 @@ class Navigator {
|
|
|
103
103
|
CommonActions.navigate({
|
|
104
104
|
name,
|
|
105
105
|
params,
|
|
106
|
-
})
|
|
106
|
+
})
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
};
|
|
@@ -124,7 +124,7 @@ class Navigator {
|
|
|
124
124
|
params,
|
|
125
125
|
},
|
|
126
126
|
],
|
|
127
|
-
})
|
|
127
|
+
})
|
|
128
128
|
);
|
|
129
129
|
}
|
|
130
130
|
};
|
|
@@ -141,9 +141,7 @@ class Navigator {
|
|
|
141
141
|
* set callback function for toolkit
|
|
142
142
|
* @param callback
|
|
143
143
|
*/
|
|
144
|
-
setToolkitCallback = (
|
|
145
|
-
callback: (item: {key: string; action: string}) => void,
|
|
146
|
-
) => {
|
|
144
|
+
setToolkitCallback = (callback: (key: string) => void) => {
|
|
147
145
|
this.toolkitCallback = callback;
|
|
148
146
|
};
|
|
149
147
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, {useContext, useEffect, useLayoutEffect, useRef} from 'react';
|
|
2
2
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
3
|
-
import {InteractionManager, Linking, View} from 'react-native';
|
|
3
|
+
import {Alert, InteractionManager, Linking, View} from 'react-native';
|
|
4
4
|
import {ScreenParams} from './types';
|
|
5
5
|
import Navigation from './Navigation';
|
|
6
6
|
import {ApplicationContext, MiniAppContext, ScreenContext} from './index';
|
|
@@ -146,6 +146,8 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
146
146
|
}, 5000);
|
|
147
147
|
|
|
148
148
|
return () => {
|
|
149
|
+
clearTimeout(tracked.current.timeoutLoad);
|
|
150
|
+
clearTimeout(tracked.current.timeoutInteraction);
|
|
149
151
|
onScreenLoad();
|
|
150
152
|
onScreenInteraction();
|
|
151
153
|
};
|
|
@@ -155,8 +157,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
155
157
|
* tracking for screen load
|
|
156
158
|
*/
|
|
157
159
|
const onScreenLoad = () => {
|
|
158
|
-
clearTimeout(tracked.current.timeoutLoad);
|
|
159
160
|
if (!tracked.current?.releaseLoad) {
|
|
161
|
+
if (timeLoad.current === 0) {
|
|
162
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
163
|
+
}
|
|
160
164
|
context.autoTracking?.({
|
|
161
165
|
appId: context.appId,
|
|
162
166
|
code: context.code,
|
|
@@ -170,6 +174,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
170
174
|
appId: `auto - ${context.appId}`,
|
|
171
175
|
message: `${screenName} screen_load_time ${timeLoad.current}`,
|
|
172
176
|
});
|
|
177
|
+
if (timeLoad.current === 0 && context.enableAutoId) {
|
|
178
|
+
Alert.alert(screenName, "Can't get screen load time");
|
|
179
|
+
}
|
|
173
180
|
tracked.current.releaseLoad = true;
|
|
174
181
|
}
|
|
175
182
|
};
|
|
@@ -178,8 +185,10 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
178
185
|
* tracking for screen load
|
|
179
186
|
*/
|
|
180
187
|
const onScreenInteraction = () => {
|
|
181
|
-
clearTimeout(tracked.current.timeoutInteraction);
|
|
182
188
|
if (!tracked.current?.releaseInteraction) {
|
|
189
|
+
if (timeLoad.current === 0) {
|
|
190
|
+
timeLoad.current = endTime.current - startTime.current;
|
|
191
|
+
}
|
|
183
192
|
context.autoTracking?.({
|
|
184
193
|
appId: context.appId,
|
|
185
194
|
code: context.code,
|
|
@@ -194,6 +203,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
194
203
|
appId: `auto - ${context.appId}`,
|
|
195
204
|
message: `${screenName} screen_interaction_time ${timeInteraction.current}`,
|
|
196
205
|
});
|
|
206
|
+
if (
|
|
207
|
+
timeInteraction.current - timeLoad.current <= 0 &&
|
|
208
|
+
context.enableAutoId
|
|
209
|
+
) {
|
|
210
|
+
Alert.alert(screenName, "Can't get screen interaction time");
|
|
211
|
+
}
|
|
197
212
|
tracked.current.releaseInteraction = true;
|
|
198
213
|
}
|
|
199
214
|
};
|
|
@@ -203,12 +218,12 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
203
218
|
value={{
|
|
204
219
|
screenName,
|
|
205
220
|
onElementLoad: () => {
|
|
221
|
+
clearTimeout(timeoutLoad.current);
|
|
206
222
|
endTime.current = Date.now();
|
|
207
223
|
interaction.current?.cancel?.();
|
|
208
224
|
interaction.current = InteractionManager.runAfterInteractions(() => {
|
|
209
225
|
timeInteraction.current = Date.now() - startTime.current;
|
|
210
226
|
});
|
|
211
|
-
clearTimeout(timeoutLoad.current);
|
|
212
227
|
timeoutLoad.current = setTimeout(() => {
|
|
213
228
|
if (timeLoad.current === 0) {
|
|
214
229
|
timeLoad.current = endTime.current - startTime.current;
|
package/Input/common.tsx
CHANGED
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -7,16 +7,16 @@ rsync -r --exclude=/dist ./* dist
|
|
|
7
7
|
cd dist
|
|
8
8
|
|
|
9
9
|
if [ "$1" == "stable" ]; then
|
|
10
|
-
#npm version$(npm view @momo-kits/foundation@stable version)
|
|
11
|
-
#npm
|
|
10
|
+
#npm version $(npm view @momo-kits/foundation@stable version)
|
|
11
|
+
#npm version patch
|
|
12
12
|
npm publish --tag stable --access=public
|
|
13
13
|
elif [ "$1" == "latest" ]; then
|
|
14
|
-
#npm version$(npm view @momo-kits/foundation@latest version)
|
|
15
|
-
#npm
|
|
14
|
+
#npm version $(npm view @momo-kits/foundation@latest version)
|
|
15
|
+
#npm version prerelease --preid=rc
|
|
16
16
|
npm publish --tag latest --access=public
|
|
17
17
|
else
|
|
18
|
-
#npm version$(npm view @momo-kits/foundation@beta version)
|
|
19
|
-
#npm
|
|
18
|
+
#npm version $(npm view @momo-kits/foundation@beta version)
|
|
19
|
+
#npm version prerelease --preid=beta
|
|
20
20
|
npm publish --tag beta --access=public
|
|
21
21
|
fi
|
|
22
22
|
|