@momo-kits/foundation 0.81.36 → 0.81.37
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/Components.tsx +3 -4
- package/Application/ModalScreen.tsx +9 -9
- package/Application/NavigationContainer.tsx +9 -2
- package/Application/StackScreen.tsx +2 -2
- package/Application/index.ts +6 -5
- package/Application/types.ts +1 -0
- package/Image/index.tsx +1 -0
- package/Layout/Card.tsx +2 -0
- package/Layout/Screen.tsx +25 -17
- package/Layout/Section.tsx +2 -0
- package/Popup/PopupNotify.tsx +2 -2
- package/Popup/PopupPromotion.tsx +2 -2
- package/package.json +1 -1
|
@@ -183,7 +183,7 @@ const HeaderLeft: React.FC<HeaderBackProps> = ({
|
|
|
183
183
|
const canGoBack = navigator?.ref.current?.canGoBack();
|
|
184
184
|
if (!canGoBack && navigator?.trackingInfo) {
|
|
185
185
|
const currentRoute = navigator?.ref?.current.getCurrentRoute();
|
|
186
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
186
|
+
navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
|
|
187
187
|
feature_code: navigator.trackingInfo.code,
|
|
188
188
|
app_id: navigator.trackingInfo.appId,
|
|
189
189
|
miniapp_version: navigator.trackingInfo.buildNumber,
|
|
@@ -242,9 +242,8 @@ const HeaderBackground: React.FC<HeaderBackgroundProps> = ({
|
|
|
242
242
|
animatedValue,
|
|
243
243
|
useBorder = false,
|
|
244
244
|
}) => {
|
|
245
|
-
const {theme
|
|
246
|
-
let headerImage =
|
|
247
|
-
config?.navigationBar?.headerBar ?? theme.assets?.headerBackground;
|
|
245
|
+
const {theme} = useContext(ApplicationContext);
|
|
246
|
+
let headerImage = theme.assets?.headerBackground;
|
|
248
247
|
if (image === null) {
|
|
249
248
|
headerImage = undefined;
|
|
250
249
|
}
|
|
@@ -95,7 +95,8 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
95
95
|
const insets = useSafeAreaInsets();
|
|
96
96
|
const {theme, navigator} = useContext(ApplicationContext);
|
|
97
97
|
const [keyboardSnap, setKeyboardSnap] = useState(0);
|
|
98
|
-
const {screen, options, snapPoint}: BottomSheetParams =
|
|
98
|
+
const {screen, options, snapPoint, indicatorColor}: BottomSheetParams =
|
|
99
|
+
props.route.params;
|
|
99
100
|
const Component = useRef(screen).current;
|
|
100
101
|
const navigation = new Navigation(props.navigation, theme);
|
|
101
102
|
const params = {
|
|
@@ -167,14 +168,7 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
167
168
|
handleComponent={null}
|
|
168
169
|
backdropComponent={backdropComponent}>
|
|
169
170
|
<BottomSheetView accessibilityLabel={'BottomSheet'}>
|
|
170
|
-
<View
|
|
171
|
-
style={[
|
|
172
|
-
styles.sheetContainer,
|
|
173
|
-
{
|
|
174
|
-
backgroundColor,
|
|
175
|
-
paddingBottom: Math.min(insets.bottom, 20) + Spacing.S,
|
|
176
|
-
},
|
|
177
|
-
]}>
|
|
171
|
+
<View style={[styles.sheetContainer, {backgroundColor}]}>
|
|
178
172
|
<View style={styles.indicatorContainer}>
|
|
179
173
|
<View
|
|
180
174
|
style={[
|
|
@@ -233,6 +227,12 @@ const BottomSheet: React.FC<BottomSheetParams> = props => {
|
|
|
233
227
|
),
|
|
234
228
|
}}
|
|
235
229
|
/>
|
|
230
|
+
<View
|
|
231
|
+
style={{
|
|
232
|
+
height: Math.min(insets.bottom, 20),
|
|
233
|
+
backgroundColor: indicatorColor ?? backgroundColor,
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
236
|
</View>
|
|
237
237
|
</BottomSheetView>
|
|
238
238
|
</BottomSheetModal>
|
|
@@ -29,7 +29,11 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
29
29
|
const navigator = useRef(new Navigator(navigationRef));
|
|
30
30
|
const [showGrid, setShowGrid] = useState(false);
|
|
31
31
|
const [language, setLanguage] = useState<'vi' | 'en'>('vi');
|
|
32
|
-
const [config, setConfig] = useState(undefined);
|
|
32
|
+
const [config, setConfig] = useState<any>(undefined);
|
|
33
|
+
let assets = theme.assets;
|
|
34
|
+
if (config) {
|
|
35
|
+
assets = {...assets, headerBackground: config.navigationBar?.headerBar};
|
|
36
|
+
}
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* handle mini language & listen change
|
|
@@ -83,7 +87,10 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
|
|
|
83
87
|
<BottomSheetModalProvider>
|
|
84
88
|
<ApplicationContext.Provider
|
|
85
89
|
value={{
|
|
86
|
-
theme
|
|
90
|
+
theme: {
|
|
91
|
+
...theme,
|
|
92
|
+
assets: assets,
|
|
93
|
+
},
|
|
87
94
|
navigator: navigator.current,
|
|
88
95
|
showGrid,
|
|
89
96
|
language,
|
|
@@ -47,14 +47,14 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
47
47
|
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
50
|
+
navigator?.maxApi?.trackEvent?.('service_frame_displayed', {
|
|
51
51
|
...tracking,
|
|
52
52
|
pre_screen_name,
|
|
53
53
|
trigger_id: '111378000000000000',
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
return props.navigation.addListener('beforeRemove', () => {
|
|
57
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
57
|
+
navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
|
|
58
58
|
...tracking,
|
|
59
59
|
trigger_id: '111154000000000000',
|
|
60
60
|
icon_name: 'back',
|
package/Application/index.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import {NavigationContainer} from './NavigationContainer';
|
|
2
2
|
import Screen from '../Layout/Screen';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
HeaderTitle,
|
|
6
|
-
HeaderLeft,
|
|
4
|
+
HeaderAnimated,
|
|
7
5
|
HeaderBackground,
|
|
6
|
+
HeaderCustom,
|
|
7
|
+
HeaderLeft,
|
|
8
8
|
HeaderRightAction,
|
|
9
|
+
HeaderTitle,
|
|
9
10
|
HeaderToolkitAction,
|
|
10
|
-
|
|
11
|
-
HeaderAnimated,
|
|
11
|
+
NavigationButton,
|
|
12
12
|
} from './Components';
|
|
13
13
|
import BottomTab from './BottomTab';
|
|
14
14
|
import {createContext} from 'react';
|
|
15
15
|
import {defaultContext} from '../Consts';
|
|
16
16
|
|
|
17
17
|
const ApplicationContext = createContext(defaultContext);
|
|
18
|
+
|
|
18
19
|
export {
|
|
19
20
|
NavigationContainer,
|
|
20
21
|
ApplicationContext,
|
package/Application/types.ts
CHANGED
package/Image/index.tsx
CHANGED
package/Layout/Card.tsx
CHANGED
|
@@ -27,6 +27,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
27
27
|
style,
|
|
28
28
|
backgroundImage,
|
|
29
29
|
useShadow = false,
|
|
30
|
+
...props
|
|
30
31
|
}) => {
|
|
31
32
|
const {showGrid} = useContext(ApplicationContext);
|
|
32
33
|
const {numberOfColumns} = useGridSystem();
|
|
@@ -141,6 +142,7 @@ const Card: React.FC<CardProps> = ({
|
|
|
141
142
|
return (
|
|
142
143
|
<GridContext.Provider value={gridContext}>
|
|
143
144
|
<View
|
|
145
|
+
{...props}
|
|
144
146
|
accessibilityLabel={`Card`}
|
|
145
147
|
style={[
|
|
146
148
|
style,
|
package/Layout/Screen.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import {useHeaderHeight} from '@react-navigation/stack';
|
|
|
12
12
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
|
13
13
|
import React, {
|
|
14
14
|
forwardRef,
|
|
15
|
+
Fragment,
|
|
15
16
|
ReactNode,
|
|
16
17
|
useContext,
|
|
17
18
|
useEffect,
|
|
@@ -101,7 +102,7 @@ const Screen = forwardRef(
|
|
|
101
102
|
ref,
|
|
102
103
|
) => {
|
|
103
104
|
const animatedValue = useRef<Animated.Value | undefined>(undefined);
|
|
104
|
-
const {theme
|
|
105
|
+
const {theme} = useContext(ApplicationContext);
|
|
105
106
|
const insets = useSafeAreaInsets();
|
|
106
107
|
const heightHeader = useHeaderHeight();
|
|
107
108
|
const currentTint = useRef(Colors.black_01);
|
|
@@ -117,8 +118,7 @@ const Screen = forwardRef(
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
if (headerType == 'extended') {
|
|
120
|
-
headerBackground =
|
|
121
|
-
config?.navigationBar?.headerBar ?? theme.assets?.headerBackground;
|
|
121
|
+
headerBackground = theme.assets?.headerBackground;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
useEffect(() => {
|
|
@@ -260,25 +260,33 @@ const Screen = forwardRef(
|
|
|
260
260
|
/**
|
|
261
261
|
* build content for screen
|
|
262
262
|
*/
|
|
263
|
-
const renderContent = () => {
|
|
264
|
-
const results = validateChildren(children, [Section, Card]);
|
|
263
|
+
const renderContent = (children: any): any => {
|
|
264
|
+
const results = validateChildren(children, [Section, Card, undefined]);
|
|
265
265
|
if (Array.isArray(results)) {
|
|
266
266
|
return results.map((item, index) => {
|
|
267
|
-
const space = item
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
267
|
+
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
268
|
+
if (item?.type == Fragment) {
|
|
269
|
+
return renderContent(item?.props?.children);
|
|
270
|
+
}
|
|
271
|
+
if (item) {
|
|
272
|
+
return (
|
|
273
|
+
<View
|
|
274
|
+
key={`ScreenItem${index}`}
|
|
275
|
+
style={{
|
|
276
|
+
marginTop: space,
|
|
277
|
+
flex: item.props?.expanded ? 1 : undefined,
|
|
278
|
+
}}>
|
|
279
|
+
{item}
|
|
280
|
+
</View>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
278
283
|
});
|
|
279
284
|
} else {
|
|
280
285
|
const item: any = children;
|
|
281
286
|
const space = item?.props?.useMargin === false ? 0 : Spacing.M;
|
|
287
|
+
if (item?.type == Fragment) {
|
|
288
|
+
return renderContent(item?.props?.children);
|
|
289
|
+
}
|
|
282
290
|
return (
|
|
283
291
|
<View
|
|
284
292
|
key={`ScreenItem`}
|
|
@@ -327,7 +335,7 @@ const Screen = forwardRef(
|
|
|
327
335
|
style={[styles.screenBanner, {maxHeight: 210 + layoutOffset}]}>
|
|
328
336
|
{renderHeader()}
|
|
329
337
|
</View>
|
|
330
|
-
{renderContent()}
|
|
338
|
+
{renderContent(children)}
|
|
331
339
|
</Component>
|
|
332
340
|
{Footer && (
|
|
333
341
|
<View
|
package/Layout/Section.tsx
CHANGED
|
@@ -33,6 +33,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
33
33
|
useMargin = true,
|
|
34
34
|
backgroundImage,
|
|
35
35
|
style,
|
|
36
|
+
...props
|
|
36
37
|
}) => {
|
|
37
38
|
const {showGrid} = useContext(ApplicationContext);
|
|
38
39
|
const {numberOfColumns} = useGridSystem();
|
|
@@ -148,6 +149,7 @@ const Section: React.FC<SectionProps> = ({
|
|
|
148
149
|
},
|
|
149
150
|
}}>
|
|
150
151
|
<View
|
|
152
|
+
{...props}
|
|
151
153
|
accessibilityLabel={`Section`}
|
|
152
154
|
style={[
|
|
153
155
|
style,
|
package/Popup/PopupNotify.tsx
CHANGED
|
@@ -51,12 +51,12 @@ const PopupNotify: React.FC<PopupNotifyProps> = ({
|
|
|
51
51
|
component_name: id,
|
|
52
52
|
error_code: error ? error : undefined,
|
|
53
53
|
};
|
|
54
|
-
navigator?.maxApi?.trackEvent('service_component_displayed', {
|
|
54
|
+
navigator?.maxApi?.trackEvent?.('service_component_displayed', {
|
|
55
55
|
...tracking,
|
|
56
56
|
trigger_id: '111012100000000000',
|
|
57
57
|
});
|
|
58
58
|
return () => {
|
|
59
|
-
navigator?.maxApi?.trackEvent('service_popup_dismissed', {
|
|
59
|
+
navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
|
|
60
60
|
...tracking,
|
|
61
61
|
trigger_id: '111154100000000001',
|
|
62
62
|
action_type: closeAction.current,
|
package/Popup/PopupPromotion.tsx
CHANGED
|
@@ -34,12 +34,12 @@ const PopupPromotion: React.FC<PopupPromotionProps> = ({
|
|
|
34
34
|
component_type: 'popup',
|
|
35
35
|
component_name: id,
|
|
36
36
|
};
|
|
37
|
-
navigator?.maxApi?.trackEvent('service_component_displayed', {
|
|
37
|
+
navigator?.maxApi?.trackEvent?.('service_component_displayed', {
|
|
38
38
|
...tracking,
|
|
39
39
|
trigger_id: '111012100000000000',
|
|
40
40
|
});
|
|
41
41
|
return () => {
|
|
42
|
-
navigator?.maxApi?.trackEvent('service_popup_dismissed', {
|
|
42
|
+
navigator?.maxApi?.trackEvent?.('service_popup_dismissed', {
|
|
43
43
|
...tracking,
|
|
44
44
|
trigger_id: '111154100000000001',
|
|
45
45
|
action_type: closeAction.current,
|