@momo-kits/foundation 0.150.2-beta.33 → 0.150.2-beta.35
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/BottomTab/index.tsx +72 -71
- package/Application/types.ts +0 -1
- package/package.json +1 -1
|
@@ -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 }) => {
|
package/Application/types.ts
CHANGED