@momo-kits/foundation 0.150.2-beta.32 → 0.150.2-beta.34
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.
|
@@ -37,7 +37,6 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
37
37
|
const { navigator } = useContext(ApplicationContext);
|
|
38
38
|
const context = useContext<any>(MiniAppContext);
|
|
39
39
|
const { nested, options, screen, initialParams } = route?.params;
|
|
40
|
-
const useAnimation = route?.params?.useAnimation ?? true;
|
|
41
40
|
const insets = useSafeAreaInsets();
|
|
42
41
|
|
|
43
42
|
const opacityValue = 0.3;
|
|
@@ -74,75 +73,78 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
74
73
|
);
|
|
75
74
|
|
|
76
75
|
useFocusEffect(
|
|
77
|
-
React.useCallback(
|
|
78
|
-
|
|
79
|
-
Animated.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
76
|
+
React.useCallback(
|
|
77
|
+
() => {
|
|
78
|
+
Animated.parallel([
|
|
79
|
+
Animated.timing(opacity, {
|
|
80
|
+
toValue: 1,
|
|
81
|
+
duration: 200,
|
|
82
|
+
useNativeDriver: true,
|
|
83
|
+
}),
|
|
84
|
+
Animated.timing(scale, {
|
|
85
|
+
toValue: 1,
|
|
86
|
+
duration: 200,
|
|
87
|
+
useNativeDriver: true,
|
|
88
|
+
}),
|
|
89
|
+
]).start();
|
|
90
90
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
setTimeout(() => {
|
|
92
|
+
navigator?.maxApi?.getDataObserver?.(
|
|
93
|
+
'current_screen',
|
|
94
|
+
(data: any) => {
|
|
95
|
+
onScreenNavigated(data?.screenName, screenName);
|
|
96
|
+
navigator?.maxApi?.setObserver?.('current_screen', {
|
|
97
|
+
screenName,
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
);
|
|
101
|
+
}, 100);
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
opacity,
|
|
119
|
-
route?.params.index,
|
|
120
|
-
scale,
|
|
121
|
-
screenName,
|
|
122
|
-
]),
|
|
103
|
+
return () => {
|
|
104
|
+
if (navigation.getState().index !== route?.params.index) {
|
|
105
|
+
Animated.parallel([
|
|
106
|
+
Animated.timing(opacity, {
|
|
107
|
+
toValue: opacityValue,
|
|
108
|
+
duration: 200,
|
|
109
|
+
useNativeDriver: true,
|
|
110
|
+
}),
|
|
111
|
+
Animated.timing(scale, {
|
|
112
|
+
toValue: scaleValue,
|
|
113
|
+
duration: 200,
|
|
114
|
+
useNativeDriver: true,
|
|
115
|
+
}),
|
|
116
|
+
]).start();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
121
|
+
[],
|
|
122
|
+
),
|
|
123
123
|
);
|
|
124
124
|
|
|
125
|
-
useEffect(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
125
|
+
useEffect(
|
|
126
|
+
() => {
|
|
127
|
+
const onFocusApp = navigator?.maxApi?.listen?.('onFocusApp', () => {
|
|
128
|
+
if (navigation.isFocused()) {
|
|
129
|
+
navigator?.maxApi?.getDataObserver?.(
|
|
130
|
+
'current_screen',
|
|
131
|
+
(data: any) => {
|
|
132
|
+
onScreenNavigated(data?.screenName, screenName);
|
|
133
|
+
navigator?.maxApi?.setObserver?.('current_screen', {
|
|
134
|
+
screenName,
|
|
135
|
+
});
|
|
136
|
+
},
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
139
140
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
return () => {
|
|
142
|
+
onFocusApp?.remove?.();
|
|
143
|
+
};
|
|
144
|
+
},
|
|
145
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
146
|
+
[],
|
|
147
|
+
);
|
|
146
148
|
|
|
147
149
|
let stackOptions = {};
|
|
148
150
|
if (options) {
|
|
@@ -155,8 +157,8 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
155
157
|
style={[
|
|
156
158
|
styles.container,
|
|
157
159
|
{
|
|
158
|
-
opacity
|
|
159
|
-
transform: [{ scale
|
|
160
|
+
opacity,
|
|
161
|
+
transform: [{ scale }],
|
|
160
162
|
},
|
|
161
163
|
]}
|
|
162
164
|
>
|
|
@@ -188,8 +190,8 @@ const TabScreen: React.FC<any> = ({ route, navigation }) => {
|
|
|
188
190
|
style={[
|
|
189
191
|
styles.container,
|
|
190
192
|
{
|
|
191
|
-
opacity
|
|
192
|
-
transform: [{ scale
|
|
193
|
+
opacity,
|
|
194
|
+
transform: [{ scale }],
|
|
193
195
|
},
|
|
194
196
|
]}
|
|
195
197
|
>
|
|
@@ -227,7 +229,6 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
227
229
|
navigation,
|
|
228
230
|
initialRouteName,
|
|
229
231
|
floatingButton,
|
|
230
|
-
useAnimation = true,
|
|
231
232
|
}) => {
|
|
232
233
|
const { theme, navigator } = useContext(ApplicationContext);
|
|
233
234
|
const dimensions = useWindowDimensions();
|
|
@@ -340,7 +341,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
340
341
|
key={`BottomTab-${item.name}`}
|
|
341
342
|
name={item.name}
|
|
342
343
|
component={TabScreen}
|
|
343
|
-
initialParams={{ ...item, nested, index
|
|
344
|
+
initialParams={{ ...item, nested, index }}
|
|
344
345
|
listeners={handler}
|
|
345
346
|
options={{
|
|
346
347
|
tabBarLabel: ({ focused, color }) => {
|
|
@@ -285,15 +285,15 @@ const StackScreen: React.FC<any> = props => {
|
|
|
285
285
|
* tracking for loading screen
|
|
286
286
|
*/
|
|
287
287
|
const onScreenLoading = () => {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
const start = tracking.current.timeStartLoading;
|
|
289
|
+
const end = tracking.current.timeEndLoading;
|
|
290
|
+
if (!tracking.current?.releaseLoading && start && end && end > start) {
|
|
291
291
|
context?.autoTracking?.({
|
|
292
292
|
...context,
|
|
293
293
|
screenName,
|
|
294
294
|
componentName: 'Screen',
|
|
295
295
|
state: 'loading',
|
|
296
|
-
duration:
|
|
296
|
+
duration: end - start,
|
|
297
297
|
loadingType: 'skeleton',
|
|
298
298
|
});
|
|
299
299
|
tracking.current.releaseLoading = true;
|
|
@@ -380,7 +380,6 @@ const StackScreen: React.FC<any> = props => {
|
|
|
380
380
|
/**
|
|
381
381
|
* tracking for loading screen
|
|
382
382
|
*/
|
|
383
|
-
clearTimeout(tracking.current.timeoutLoading);
|
|
384
383
|
if (!loading) {
|
|
385
384
|
tracking.current.timeEndLoading = Date.now();
|
|
386
385
|
}
|
|
@@ -388,6 +387,7 @@ const StackScreen: React.FC<any> = props => {
|
|
|
388
387
|
/**
|
|
389
388
|
* timeout for handle tracking screen
|
|
390
389
|
*/
|
|
390
|
+
clearTimeout(tracking.current.timeoutLoading);
|
|
391
391
|
tracking.current.timeoutLoading = setTimeout(() => {
|
|
392
392
|
onScreenLoading();
|
|
393
393
|
}, 2000);
|
package/Application/types.ts
CHANGED