@momo-kits/foundation 0.111.1-optimize.5 → 0.111.1-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.
|
@@ -19,6 +19,32 @@ const BackgroundImageView: FC<BackgroundImageViewProps> = ({
|
|
|
19
19
|
opacityBackground,
|
|
20
20
|
}) => {
|
|
21
21
|
const {theme} = useContext(ApplicationContext);
|
|
22
|
+
if (Platform.OS === 'android') {
|
|
23
|
+
return (
|
|
24
|
+
<Animated.View
|
|
25
|
+
style={[
|
|
26
|
+
useShadowHeader ? styles.shadowHeader : styles.dividerHeader,
|
|
27
|
+
{
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
width: '100%',
|
|
30
|
+
zIndex: 1,
|
|
31
|
+
height: heightHeader,
|
|
32
|
+
backgroundColor: theme.colors.background.surface,
|
|
33
|
+
opacity: opacityBackground,
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
},
|
|
36
|
+
]}>
|
|
37
|
+
{headerBackground && (
|
|
38
|
+
<Image
|
|
39
|
+
style={styles.headerBackground}
|
|
40
|
+
source={{uri: headerBackground}}
|
|
41
|
+
loading={false}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
</Animated.View>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
22
48
|
return (
|
|
23
49
|
<>
|
|
24
50
|
<Animated.View
|
|
@@ -31,10 +57,21 @@ const BackgroundImageView: FC<BackgroundImageViewProps> = ({
|
|
|
31
57
|
height: heightHeader,
|
|
32
58
|
backgroundColor: theme.colors.background.surface,
|
|
33
59
|
opacity: opacityBackground,
|
|
34
|
-
|
|
60
|
+
},
|
|
61
|
+
]}
|
|
62
|
+
/>
|
|
63
|
+
<Animated.View
|
|
64
|
+
style={[
|
|
65
|
+
{
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
width: '100%',
|
|
68
|
+
zIndex: 1,
|
|
69
|
+
height: heightHeader,
|
|
70
|
+
opacity: opacityBackground,
|
|
71
|
+
overflow: 'hidden',
|
|
35
72
|
},
|
|
36
73
|
]}>
|
|
37
|
-
{
|
|
74
|
+
{headerBackground && (
|
|
38
75
|
<Image
|
|
39
76
|
style={styles.headerBackground}
|
|
40
77
|
source={{uri: headerBackground}}
|
|
@@ -42,26 +79,6 @@ const BackgroundImageView: FC<BackgroundImageViewProps> = ({
|
|
|
42
79
|
/>
|
|
43
80
|
)}
|
|
44
81
|
</Animated.View>
|
|
45
|
-
{Platform.OS === 'ios' && (
|
|
46
|
-
<Animated.View
|
|
47
|
-
style={[
|
|
48
|
-
{
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
width: '100%',
|
|
51
|
-
zIndex: 1,
|
|
52
|
-
height: heightHeader,
|
|
53
|
-
overflow: 'hidden',
|
|
54
|
-
},
|
|
55
|
-
]}>
|
|
56
|
-
{headerBackground && (
|
|
57
|
-
<Image
|
|
58
|
-
style={styles.headerBackground}
|
|
59
|
-
source={{uri: headerBackground}}
|
|
60
|
-
loading={false}
|
|
61
|
-
/>
|
|
62
|
-
)}
|
|
63
|
-
</Animated.View>
|
|
64
|
-
)}
|
|
65
82
|
</>
|
|
66
83
|
);
|
|
67
84
|
};
|
|
@@ -69,14 +69,14 @@ const styles = StyleSheet.create({
|
|
|
69
69
|
overflow: 'hidden',
|
|
70
70
|
},
|
|
71
71
|
extendedHeader: {
|
|
72
|
-
aspectRatio:
|
|
72
|
+
aspectRatio: 375 / 154,
|
|
73
73
|
position: 'absolute',
|
|
74
74
|
width: '100%',
|
|
75
75
|
},
|
|
76
76
|
headerBackground: {
|
|
77
77
|
width: '100%',
|
|
78
78
|
position: 'absolute',
|
|
79
|
-
aspectRatio: 375 /
|
|
79
|
+
aspectRatio: 375 / 154,
|
|
80
80
|
},
|
|
81
81
|
});
|
|
82
82
|
|
|
@@ -34,7 +34,6 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
34
34
|
const isReady = useRef(false);
|
|
35
35
|
const navigator = useRef(new Navigator(navigationRef, isReady));
|
|
36
36
|
const [showGrid, setShowGrid] = useState(false);
|
|
37
|
-
const [currentContext, setCurrentContext] = useState({});
|
|
38
37
|
|
|
39
38
|
let config: any = null;
|
|
40
39
|
try {
|
|
@@ -105,103 +104,91 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
105
104
|
});
|
|
106
105
|
};
|
|
107
106
|
|
|
108
|
-
const headerBackground =
|
|
107
|
+
const headerBackground = theme.assets?.headerBackground || config?.headerBar;
|
|
109
108
|
const headerGradient = config?.headerGradient || theme.colors?.gradient;
|
|
110
109
|
|
|
111
|
-
navigator.current.setCurrentContext = setCurrentContext;
|
|
112
|
-
|
|
113
110
|
return (
|
|
114
111
|
<SafeAreaProvider>
|
|
115
|
-
<
|
|
112
|
+
<ApplicationContext.Provider
|
|
116
113
|
value={{
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
navigator: navigator.current,
|
|
115
|
+
theme: {
|
|
116
|
+
...theme,
|
|
117
|
+
colors: {
|
|
118
|
+
...theme.colors,
|
|
119
|
+
gradient: headerGradient,
|
|
120
|
+
},
|
|
121
|
+
assets: {
|
|
122
|
+
...theme.assets,
|
|
123
|
+
headerBackground,
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
showGrid,
|
|
127
|
+
translate,
|
|
119
128
|
}}>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
...theme,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
...theme.assets,
|
|
131
|
-
headerBackground,
|
|
132
|
-
},
|
|
129
|
+
<ReactNavigationContainer
|
|
130
|
+
theme={{
|
|
131
|
+
...theme,
|
|
132
|
+
colors: {
|
|
133
|
+
...theme.colors,
|
|
134
|
+
background: theme.colors.background.default,
|
|
135
|
+
card: theme.colors.background.surface,
|
|
136
|
+
text: theme.colors.text.default,
|
|
137
|
+
border: theme.colors.border.default,
|
|
138
|
+
notification: theme.colors.error.primary,
|
|
133
139
|
},
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
isReady.current = true;
|
|
152
|
-
routes.current = navigationRef.current?.getRootState?.()?.routes;
|
|
153
|
-
maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
|
|
154
|
-
onScreenNavigated(data?.screenName, screen?.name, 'push');
|
|
155
|
-
maxApi?.setObserver('CURRENT_SCREEN', {
|
|
156
|
-
screenName: screen?.name,
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
}}
|
|
160
|
-
onStateChange={state => {
|
|
161
|
-
const lastedRoute: any =
|
|
162
|
-
state?.routes?.[state?.routes?.length - 1];
|
|
163
|
-
const oldRoute: any =
|
|
164
|
-
routes.current?.[routes.current?.length - 1];
|
|
165
|
-
const lasted = lastedRoute?.params?.screen;
|
|
166
|
-
const previous = oldRoute?.params?.screen;
|
|
167
|
-
const preScreenName = previous?.name ?? previous?.type?.name;
|
|
168
|
-
const screenName = lasted?.name ?? lasted?.type?.name;
|
|
140
|
+
}}
|
|
141
|
+
ref={navigationRef}
|
|
142
|
+
onReady={() => {
|
|
143
|
+
isReady.current = true;
|
|
144
|
+
routes.current = navigationRef.current?.getRootState?.()?.routes;
|
|
145
|
+
maxApi?.getDataObserver('CURRENT_SCREEN', (data: any) => {
|
|
146
|
+
onScreenNavigated(data?.screenName, screen?.name, 'push');
|
|
147
|
+
maxApi?.setObserver('CURRENT_SCREEN', {screenName: screen?.name});
|
|
148
|
+
});
|
|
149
|
+
}}
|
|
150
|
+
onStateChange={state => {
|
|
151
|
+
const lastedRoute: any = state?.routes?.[state?.routes?.length - 1];
|
|
152
|
+
const oldRoute: any = routes.current?.[routes.current?.length - 1];
|
|
153
|
+
const lasted = lastedRoute?.params?.screen;
|
|
154
|
+
const previous = oldRoute?.params?.screen;
|
|
155
|
+
const preScreenName = previous?.name ?? previous?.type?.name;
|
|
156
|
+
const screenName = lasted?.name ?? lasted?.type?.name;
|
|
169
157
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
</MiniAppContext.Provider>
|
|
158
|
+
let action = 'push';
|
|
159
|
+
if (routes.current?.length > (state?.routes?.length ?? 0)) {
|
|
160
|
+
action = 'back';
|
|
161
|
+
}
|
|
162
|
+
onScreenNavigated(preScreenName, screenName, action);
|
|
163
|
+
maxApi?.setObserver('CURRENT_SCREEN', {screenName});
|
|
164
|
+
routes.current = state?.routes;
|
|
165
|
+
}}
|
|
166
|
+
independent={true}>
|
|
167
|
+
<Stack.Navigator initialRouteName="Stack" headerMode="screen">
|
|
168
|
+
<Stack.Screen
|
|
169
|
+
name="Stack"
|
|
170
|
+
component={StackScreen}
|
|
171
|
+
initialParams={{screen, initialParams}}
|
|
172
|
+
options={{
|
|
173
|
+
...getStackOptions(),
|
|
174
|
+
...(options as StackNavigationOptions),
|
|
175
|
+
}}
|
|
176
|
+
/>
|
|
177
|
+
<Stack.Screen
|
|
178
|
+
name="Dialog"
|
|
179
|
+
component={StackScreen}
|
|
180
|
+
options={getDialogOptions()}
|
|
181
|
+
initialParams={{screen}}
|
|
182
|
+
/>
|
|
183
|
+
<Stack.Screen
|
|
184
|
+
name="Modal"
|
|
185
|
+
component={ModalScreen}
|
|
186
|
+
options={getModalOptions()}
|
|
187
|
+
initialParams={{screen}}
|
|
188
|
+
/>
|
|
189
|
+
</Stack.Navigator>
|
|
190
|
+
</ReactNavigationContainer>
|
|
191
|
+
</ApplicationContext.Provider>
|
|
205
192
|
</SafeAreaProvider>
|
|
206
193
|
);
|
|
207
194
|
};
|