@momo-kits/foundation 0.81.36-beta.4 → 0.81.36-tracking.2
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 +1 -1
- package/Application/ModalScreen.tsx +9 -9
- package/Application/StackScreen.tsx +12 -4
- package/Application/index.ts +6 -5
- package/Button/index.tsx +33 -15
- package/Image/index.tsx +1 -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,
|
|
@@ -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: props?.indicatorColor ?? backgroundColor,
|
|
175
|
-
paddingBottom: Math.min(insets.bottom, 20),
|
|
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>
|
|
@@ -5,6 +5,10 @@ import {ApplicationContext} from './index';
|
|
|
5
5
|
import {GridSystem} from '../Layout';
|
|
6
6
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
7
7
|
|
|
8
|
+
const {
|
|
9
|
+
ScreenContext,
|
|
10
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
11
|
+
|
|
8
12
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
9
13
|
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
10
14
|
const {theme, showGrid, navigator} = useContext(ApplicationContext);
|
|
@@ -47,14 +51,14 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
47
51
|
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
54
|
+
navigator?.maxApi?.trackEvent?.('service_frame_displayed', {
|
|
51
55
|
...tracking,
|
|
52
56
|
pre_screen_name,
|
|
53
57
|
trigger_id: '111378000000000000',
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
return props.navigation.addListener('beforeRemove', () => {
|
|
57
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
61
|
+
navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
|
|
58
62
|
...tracking,
|
|
59
63
|
trigger_id: '111154000000000000',
|
|
60
64
|
icon_name: 'back',
|
|
@@ -64,10 +68,14 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
64
68
|
}, []);
|
|
65
69
|
|
|
66
70
|
return (
|
|
67
|
-
|
|
71
|
+
<ScreenContext.Provider
|
|
72
|
+
value={{
|
|
73
|
+
screenName: Component.name,
|
|
74
|
+
elementTracking: navigator?.maxApi?.elementTracking,
|
|
75
|
+
}}>
|
|
68
76
|
<Component heightHeader={heightHeader} {...params} />
|
|
69
77
|
{showGrid && <GridSystem />}
|
|
70
|
-
|
|
78
|
+
</ScreenContext.Provider>
|
|
71
79
|
);
|
|
72
80
|
};
|
|
73
81
|
|
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/Button/index.tsx
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
TouchableOpacityProps,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
|
|
10
9
|
import LinearGradient from 'react-native-linear-gradient';
|
|
11
10
|
import {ApplicationContext} from '../Application';
|
|
12
11
|
import {Text} from '../Text';
|
|
@@ -16,6 +15,10 @@ import styles from './styles';
|
|
|
16
15
|
import {Icon} from '../Icon';
|
|
17
16
|
import {Loader} from '../Loader';
|
|
18
17
|
|
|
18
|
+
const {
|
|
19
|
+
ScreenContext,
|
|
20
|
+
} = require('react-native/Libraries/Components/ScreenContext');
|
|
21
|
+
|
|
19
22
|
const AnimationLinear = Animated.createAnimatedComponent(LinearGradient);
|
|
20
23
|
|
|
21
24
|
export interface ButtonProps extends TouchableOpacityProps {
|
|
@@ -82,6 +85,7 @@ const Button: FC<ButtonProps> = ({
|
|
|
82
85
|
loading = false,
|
|
83
86
|
title = 'Button',
|
|
84
87
|
onPress,
|
|
88
|
+
accessibilityLabel,
|
|
85
89
|
...rest
|
|
86
90
|
}) => {
|
|
87
91
|
const {theme, config} = useContext(ApplicationContext);
|
|
@@ -94,6 +98,8 @@ const Button: FC<ButtonProps> = ({
|
|
|
94
98
|
end: {x: 0, y: 0.5},
|
|
95
99
|
};
|
|
96
100
|
}
|
|
101
|
+
|
|
102
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
97
103
|
const getSizeStyle = () => {
|
|
98
104
|
const styleSheet: {[key: string]: any} = styles;
|
|
99
105
|
return styleSheet[size ?? 'small'];
|
|
@@ -291,20 +297,32 @@ const Button: FC<ButtonProps> = ({
|
|
|
291
297
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
292
298
|
|
|
293
299
|
return (
|
|
294
|
-
<
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
300
|
+
<ScreenContext.Provider
|
|
301
|
+
value={{
|
|
302
|
+
...screenInfo,
|
|
303
|
+
componentName: 'Button',
|
|
304
|
+
params: {
|
|
305
|
+
title,
|
|
306
|
+
accessibilityLabel,
|
|
307
|
+
},
|
|
308
|
+
}}>
|
|
309
|
+
<TouchableOpacity
|
|
310
|
+
{...rest}
|
|
311
|
+
accessibilityLabel={`${screenInfo.screenName}/Button/${
|
|
312
|
+
accessibilityLabel ?? title
|
|
313
|
+
}`}
|
|
314
|
+
activeOpacity={activeOpacity}
|
|
315
|
+
onPress={onPressButton}
|
|
316
|
+
style={buttonStyle}>
|
|
317
|
+
{renderLeading()}
|
|
318
|
+
{renderTitle()}
|
|
319
|
+
{renderTrailing()}
|
|
320
|
+
{gradientPros && (
|
|
321
|
+
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
322
|
+
)}
|
|
323
|
+
{gradientPros && <View style={styles.strokeView} />}
|
|
324
|
+
</TouchableOpacity>
|
|
325
|
+
</ScreenContext.Provider>
|
|
308
326
|
);
|
|
309
327
|
};
|
|
310
328
|
|
package/Image/index.tsx
CHANGED
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,
|