@momo-kits/foundation 0.110.1-optimize.10 → 0.110.1-optimize.11
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.
|
@@ -12,7 +12,6 @@ const LinearGradientAnimated = Animated.createAnimatedComponent(LinearGradient);
|
|
|
12
12
|
* header background for default
|
|
13
13
|
*/
|
|
14
14
|
const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
15
|
-
image,
|
|
16
15
|
animatedValue = new Animated.Value(0),
|
|
17
16
|
useGradient = true,
|
|
18
17
|
useShadowHeader = true,
|
|
@@ -20,13 +19,8 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
20
19
|
headerBackground,
|
|
21
20
|
}) => {
|
|
22
21
|
const {theme} = useContext(ApplicationContext);
|
|
23
|
-
|
|
24
22
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
25
|
-
|
|
26
|
-
let headerImage = headerBackground ?? theme.assets?.headerBackground;
|
|
27
|
-
if (image === null) {
|
|
28
|
-
headerImage = undefined;
|
|
29
|
-
}
|
|
23
|
+
const headerImage = headerBackground ?? theme.assets?.headerBackground;
|
|
30
24
|
|
|
31
25
|
const opacityBackground = animatedValue?.interpolate({
|
|
32
26
|
inputRange: [0, 52],
|
|
@@ -39,6 +33,10 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
39
33
|
extrapolate: 'clamp',
|
|
40
34
|
});
|
|
41
35
|
|
|
36
|
+
if (Platform.OS === 'android' && headerImage) {
|
|
37
|
+
useShadowHeader = false;
|
|
38
|
+
}
|
|
39
|
+
|
|
42
40
|
return (
|
|
43
41
|
<View style={Styles.flex}>
|
|
44
42
|
<Animated.View
|
|
@@ -46,7 +46,6 @@ const HeaderExtendHeader: React.FC<{
|
|
|
46
46
|
const gradientColor = customGradientColor ?? theme.colors.gradient;
|
|
47
47
|
const headerBackground = customBackground ?? theme.assets?.headerBackground;
|
|
48
48
|
const leftPosition = inputSearchProps?.leftPosition || BACK_WIDTH + 20;
|
|
49
|
-
const isIos = Platform.OS === 'ios';
|
|
50
49
|
|
|
51
50
|
const opacityBackground = animatedValue?.interpolate({
|
|
52
51
|
inputRange: [0, 52],
|
|
@@ -89,15 +88,17 @@ const HeaderExtendHeader: React.FC<{
|
|
|
89
88
|
extrapolate: 'clamp',
|
|
90
89
|
});
|
|
91
90
|
|
|
91
|
+
if (Platform.OS === 'android' && headerBackground) {
|
|
92
|
+
useShadowHeader = false;
|
|
93
|
+
}
|
|
94
|
+
|
|
92
95
|
if (inputSearchProps) {
|
|
93
96
|
return (
|
|
94
97
|
<>
|
|
95
98
|
<Animated.View style={{height: height}} />
|
|
96
99
|
<Animated.View
|
|
97
100
|
style={[
|
|
98
|
-
|
|
99
|
-
? styles.shadowHeader
|
|
100
|
-
: styles.dividerHeader,
|
|
101
|
+
useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
|
|
101
102
|
{
|
|
102
103
|
position: 'absolute',
|
|
103
104
|
width: '100%',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {useContext, useEffect, useState} from 'react';
|
|
1
|
+
import React, {useCallback, useContext, useEffect, useState} from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Platform,
|
|
4
4
|
StyleSheet,
|
|
@@ -90,14 +90,17 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
90
90
|
/**
|
|
91
91
|
* check app is favorite
|
|
92
92
|
*/
|
|
93
|
-
const checkAppIsFavorite = (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const checkAppIsFavorite = useCallback(
|
|
94
|
+
() =>
|
|
95
|
+
navigator?.maxApi?.dispatchFunction(
|
|
96
|
+
'isFavoriteApp',
|
|
97
|
+
{code: context?.code},
|
|
98
|
+
(result: boolean) => {
|
|
99
|
+
setIsFavorite(result);
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
[context]
|
|
103
|
+
);
|
|
101
104
|
|
|
102
105
|
/**
|
|
103
106
|
* close navigation container
|
|
@@ -147,12 +150,13 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
147
150
|
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
148
151
|
});
|
|
149
152
|
setIsLoading(true);
|
|
150
|
-
navigator?.maxApi?.dispatchFunction
|
|
153
|
+
navigator?.maxApi?.dispatchFunction(
|
|
151
154
|
'onToolAction',
|
|
152
155
|
{
|
|
153
156
|
item: {
|
|
154
157
|
key: 'onFavorite',
|
|
155
158
|
},
|
|
159
|
+
context,
|
|
156
160
|
},
|
|
157
161
|
({success}: {success: boolean}) => {
|
|
158
162
|
if (success) {
|
|
@@ -217,17 +221,22 @@ const HeaderToolkitAction: React.FC<any> = ({
|
|
|
217
221
|
screenName: currentRoute?.params?.screen?.name ?? currentRoute?.name,
|
|
218
222
|
});
|
|
219
223
|
|
|
220
|
-
navigator?.maxApi?.dispatchFunction
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
pressedTool?.
|
|
227
|
-
|
|
224
|
+
navigator?.maxApi?.dispatchFunction(
|
|
225
|
+
'showTools',
|
|
226
|
+
tools,
|
|
227
|
+
context,
|
|
228
|
+
(key: string) => {
|
|
229
|
+
for (const group of tools) {
|
|
230
|
+
const pressedTool = group?.items?.find?.(
|
|
231
|
+
(tool: Tool) => tool?.key === key
|
|
232
|
+
);
|
|
233
|
+
if (pressedTool) {
|
|
234
|
+
pressedTool?.onPress();
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
228
237
|
}
|
|
229
238
|
}
|
|
230
|
-
|
|
239
|
+
);
|
|
231
240
|
};
|
|
232
241
|
|
|
233
242
|
let iconShortcut = isFavorite ? 'pin_star_checked' : 'pin_star';
|
|
@@ -225,12 +225,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
225
225
|
}, 2000);
|
|
226
226
|
},
|
|
227
227
|
}}>
|
|
228
|
-
<Component
|
|
229
|
-
heightHeader={heightHeader}
|
|
230
|
-
{...data}
|
|
231
|
-
onScreenLoad={onScreenLoad}
|
|
232
|
-
onScreenInteraction={onScreenInteraction}
|
|
233
|
-
/>
|
|
228
|
+
<Component heightHeader={heightHeader} {...data} />
|
|
234
229
|
{showGrid && <GridSystem />}
|
|
235
230
|
</ScreenContext.Provider>
|
|
236
231
|
);
|