@momo-kits/foundation 0.109.1-optimize.7 → 0.109.1-optimize.9
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 +20 -2
- package/Application/Components/HeaderAnimated.tsx +1 -1
- package/Application/Components/HeaderExtendHeader.tsx +1 -1
- package/Application/Components/HeaderRight.tsx +1 -1
- package/Application/Components/HeaderTitle.tsx +2 -2
- package/Application/Components/NavigationButton.tsx +1 -1
- package/Application/types.ts +1 -5
- package/Layout/Screen.tsx +21 -1
- package/package.json +1 -1
|
@@ -2,7 +2,8 @@ import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
|
|
|
2
2
|
import {NavigationContainer} from '@react-navigation/native';
|
|
3
3
|
import {createStackNavigator} from '@react-navigation/stack';
|
|
4
4
|
import React, {useContext, useEffect} from 'react';
|
|
5
|
-
import {Platform} from 'react-native';
|
|
5
|
+
import {Platform, StatusBar} from 'react-native';
|
|
6
|
+
import {EventArg} from '@react-navigation/core';
|
|
6
7
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
7
8
|
import {Colors} from '../../Consts';
|
|
8
9
|
import {Icon} from '../../Icon';
|
|
@@ -75,6 +76,23 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
75
76
|
});
|
|
76
77
|
}, []);
|
|
77
78
|
|
|
79
|
+
const handler: {
|
|
80
|
+
tabPress?: (e: EventArg<'tabPress', true>) => void;
|
|
81
|
+
focus?: (e: EventArg<'focus', false, unknown>) => void;
|
|
82
|
+
blur?: (e: EventArg<'blur', false, unknown>) => void;
|
|
83
|
+
} = {
|
|
84
|
+
tabPress: e => {
|
|
85
|
+
listeners?.tabPress?.(e);
|
|
86
|
+
},
|
|
87
|
+
focus: e => {
|
|
88
|
+
StatusBar.setBarStyle('default', true);
|
|
89
|
+
listeners?.focus?.(e);
|
|
90
|
+
},
|
|
91
|
+
blur: e => {
|
|
92
|
+
listeners?.blur?.(e);
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
78
96
|
return (
|
|
79
97
|
<Tab.Navigator
|
|
80
98
|
initialRouteName={initialRouteName}
|
|
@@ -105,7 +123,7 @@ const BottomTab: React.FC<BottomTabProps> = ({
|
|
|
105
123
|
name={item.name}
|
|
106
124
|
component={TabScreen}
|
|
107
125
|
initialParams={{...item, nested}}
|
|
108
|
-
listeners={
|
|
126
|
+
listeners={handler}
|
|
109
127
|
options={{
|
|
110
128
|
tabBarLabel: ({color, focused}) => {
|
|
111
129
|
return (
|
|
@@ -54,7 +54,7 @@ const HeaderAnimated: React.FC<HeaderAnimatedProps> = ({
|
|
|
54
54
|
|
|
55
55
|
const Verified: React.FC<any> = () => {
|
|
56
56
|
const context = useContext<any>(MiniAppContext);
|
|
57
|
-
if (
|
|
57
|
+
if (context.environment === 'uat') {
|
|
58
58
|
return <View style={styles.verifiedDot} />;
|
|
59
59
|
}
|
|
60
60
|
return <View />;
|
|
@@ -195,7 +195,7 @@ const HeaderExtendHeader: React.FC<{
|
|
|
195
195
|
|
|
196
196
|
const Verified: React.FC<any> = () => {
|
|
197
197
|
const context = useContext<any>(MiniAppContext);
|
|
198
|
-
if (
|
|
198
|
+
if (context.environment === 'uat') {
|
|
199
199
|
return <View style={styles.verifiedDot} />;
|
|
200
200
|
}
|
|
201
201
|
return <View />;
|
|
@@ -213,7 +213,7 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
213
213
|
|
|
214
214
|
const Verified: React.FC<any> = () => {
|
|
215
215
|
const context = useContext<any>(MiniAppContext);
|
|
216
|
-
if (
|
|
216
|
+
if (context.environment === 'uat') {
|
|
217
217
|
return <View style={styles.verifiedDot} />;
|
|
218
218
|
}
|
|
219
219
|
return <View />;
|
|
@@ -214,7 +214,7 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
|
|
|
214
214
|
)}
|
|
215
215
|
</View>
|
|
216
216
|
<Icon
|
|
217
|
-
source={'
|
|
217
|
+
source={'16_arrow_chevron_down_small'}
|
|
218
218
|
size={16}
|
|
219
219
|
color={tintColor}
|
|
220
220
|
style={{marginHorizontal: Spacing.XS, marginVertical: Spacing.XXS}}
|
|
@@ -237,7 +237,7 @@ const TitleJourney: React.FC<TitleJourneyProps> = ({
|
|
|
237
237
|
|
|
238
238
|
const Verified: React.FC<any> = () => {
|
|
239
239
|
const context = useContext<any>(MiniAppContext);
|
|
240
|
-
if (
|
|
240
|
+
if (context.environment === 'uat') {
|
|
241
241
|
return <View style={styles.verifiedDot} />;
|
|
242
242
|
}
|
|
243
243
|
return <View />;
|
|
@@ -48,7 +48,7 @@ const NavigationButton: React.FC<NavigationButtonProps> = ({
|
|
|
48
48
|
|
|
49
49
|
const Verified: React.FC<any> = () => {
|
|
50
50
|
const context = useContext<any>(MiniAppContext);
|
|
51
|
-
if (
|
|
51
|
+
if (context.environment === 'uat') {
|
|
52
52
|
return <View style={styles.verifiedDot} />;
|
|
53
53
|
}
|
|
54
54
|
return <View />;
|
package/Application/types.ts
CHANGED
|
@@ -166,6 +166,7 @@ export type HeaderRightToolkit = {
|
|
|
166
166
|
useShortcut?: boolean;
|
|
167
167
|
tools?: Tool[];
|
|
168
168
|
preventClose?: PopupNotifyProps;
|
|
169
|
+
useMore?: boolean;
|
|
169
170
|
};
|
|
170
171
|
|
|
171
172
|
export interface HeaderBackProps extends NavigationButtonProps {
|
|
@@ -231,11 +232,6 @@ export type BottomTabItemProps = {
|
|
|
231
232
|
screen: Screen;
|
|
232
233
|
options: NavigationOptions;
|
|
233
234
|
initialParams?: any;
|
|
234
|
-
listeners?: {
|
|
235
|
-
tabPress?: (e: EventArg<'tabPress', true, undefined>) => void;
|
|
236
|
-
focus?: (e: EventArg<'focus', false, unknown>) => void;
|
|
237
|
-
blur?: (e: EventArg<'blur', false, unknown>) => void;
|
|
238
|
-
};
|
|
239
235
|
};
|
|
240
236
|
|
|
241
237
|
export type BottomTabProps = {
|
package/Layout/Screen.tsx
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
Platform,
|
|
18
18
|
ScrollView,
|
|
19
19
|
ScrollViewProps,
|
|
20
|
+
StatusBar,
|
|
21
|
+
StatusBarStyle,
|
|
20
22
|
View,
|
|
21
23
|
ViewProps,
|
|
22
24
|
} from 'react-native';
|
|
@@ -356,6 +358,14 @@ const Screen = forwardRef(
|
|
|
356
358
|
};
|
|
357
359
|
|
|
358
360
|
useEffect(() => {
|
|
361
|
+
const focus = navigation?.instance?.addListener?.('focus', () => {
|
|
362
|
+
let barStyle: StatusBarStyle = 'dark-content';
|
|
363
|
+
if (currentTint.current === Colors.black_01) {
|
|
364
|
+
barStyle = 'light-content';
|
|
365
|
+
}
|
|
366
|
+
StatusBar.setBarStyle(barStyle, true);
|
|
367
|
+
});
|
|
368
|
+
|
|
359
369
|
if (animatedHeader) {
|
|
360
370
|
setAnimatedHeader(animatedHeader);
|
|
361
371
|
} else if (inputSearchProps) {
|
|
@@ -363,6 +373,10 @@ const Screen = forwardRef(
|
|
|
363
373
|
} else {
|
|
364
374
|
setHeaderType(headerType);
|
|
365
375
|
}
|
|
376
|
+
|
|
377
|
+
return () => {
|
|
378
|
+
focus?.();
|
|
379
|
+
};
|
|
366
380
|
}, [headerType, animatedHeader, inputSearchProps, useShadowHeader]);
|
|
367
381
|
|
|
368
382
|
/**
|
|
@@ -401,13 +415,19 @@ const Screen = forwardRef(
|
|
|
401
415
|
const offsetY = e.nativeEvent.contentOffset.y;
|
|
402
416
|
let color = animatedHeader?.headerTintColor ?? Colors.black_17;
|
|
403
417
|
if (offsetY > 50) {
|
|
404
|
-
color =
|
|
418
|
+
color = Colors.black_17;
|
|
405
419
|
}
|
|
406
420
|
if (color !== currentTint.current) {
|
|
407
421
|
currentTint.current = color;
|
|
408
422
|
navigation?.setOptions({
|
|
409
423
|
headerTintColor: color,
|
|
410
424
|
});
|
|
425
|
+
|
|
426
|
+
let barStyle: StatusBarStyle = 'dark-content';
|
|
427
|
+
if (currentTint.current === Colors.black_01) {
|
|
428
|
+
barStyle = 'light-content';
|
|
429
|
+
}
|
|
430
|
+
StatusBar.setBarStyle(barStyle, true);
|
|
411
431
|
}
|
|
412
432
|
}
|
|
413
433
|
},
|