@momo-kits/foundation 0.81.36-beta.3 → 0.81.36-tracking.1
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 +9 -4
- package/Application/index.ts +6 -5
- package/Application/types.ts +1 -0
- package/Button/index.tsx +23 -15
- 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,
|
|
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>
|
|
@@ -4,6 +4,7 @@ import Navigation from './Navigation';
|
|
|
4
4
|
import {ApplicationContext} from './index';
|
|
5
5
|
import {GridSystem} from '../Layout';
|
|
6
6
|
import {useHeaderHeight} from '@react-navigation/stack';
|
|
7
|
+
import {ScreenContext} from 'react-native/Libraries/Components/ScreenContext';
|
|
7
8
|
|
|
8
9
|
const StackScreen: React.FC<ScreenParams> = props => {
|
|
9
10
|
const {screen: Component, options}: ScreenParams = props.route.params;
|
|
@@ -47,14 +48,14 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
47
48
|
pre_screen_name = routes[routesLength - 2]?.params?.screen?.name;
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
navigator?.maxApi?.trackEvent('service_frame_displayed', {
|
|
51
|
+
navigator?.maxApi?.trackEvent?.('service_frame_displayed', {
|
|
51
52
|
...tracking,
|
|
52
53
|
pre_screen_name,
|
|
53
54
|
trigger_id: '111378000000000000',
|
|
54
55
|
});
|
|
55
56
|
|
|
56
57
|
return props.navigation.addListener('beforeRemove', () => {
|
|
57
|
-
navigator?.maxApi?.trackEvent('service_icon_clicked', {
|
|
58
|
+
navigator?.maxApi?.trackEvent?.('service_icon_clicked', {
|
|
58
59
|
...tracking,
|
|
59
60
|
trigger_id: '111154000000000000',
|
|
60
61
|
icon_name: 'back',
|
|
@@ -64,10 +65,14 @@ const StackScreen: React.FC<ScreenParams> = props => {
|
|
|
64
65
|
}, []);
|
|
65
66
|
|
|
66
67
|
return (
|
|
67
|
-
|
|
68
|
+
<ScreenContext.Provider
|
|
69
|
+
value={{
|
|
70
|
+
screenName: Component.name,
|
|
71
|
+
elementTracking: navigator?.maxApi?.elementTracking,
|
|
72
|
+
}}>
|
|
68
73
|
<Component heightHeader={heightHeader} {...params} />
|
|
69
74
|
{showGrid && <GridSystem />}
|
|
70
|
-
|
|
75
|
+
</ScreenContext.Provider>
|
|
71
76
|
);
|
|
72
77
|
};
|
|
73
78
|
|
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/Button/index.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
TouchableOpacityProps,
|
|
7
7
|
View,
|
|
8
8
|
} from 'react-native';
|
|
9
|
-
|
|
9
|
+
import {ScreenContext} from 'react-native/Libraries/Components/ScreenContext';
|
|
10
10
|
import LinearGradient from 'react-native-linear-gradient';
|
|
11
11
|
import {ApplicationContext} from '../Application';
|
|
12
12
|
import {Text} from '../Text';
|
|
@@ -94,6 +94,8 @@ const Button: FC<ButtonProps> = ({
|
|
|
94
94
|
end: {x: 0, y: 0.5},
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
+
|
|
98
|
+
const screenInfo = useContext<any>(ScreenContext);
|
|
97
99
|
const getSizeStyle = () => {
|
|
98
100
|
const styleSheet: {[key: string]: any} = styles;
|
|
99
101
|
return styleSheet[size ?? 'small'];
|
|
@@ -291,20 +293,26 @@ const Button: FC<ButtonProps> = ({
|
|
|
291
293
|
const activeOpacity = type === 'disabled' ? 0.75 : 0.5;
|
|
292
294
|
|
|
293
295
|
return (
|
|
294
|
-
<
|
|
295
|
-
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
296
|
+
<ScreenContext.Provider
|
|
297
|
+
value={{
|
|
298
|
+
...screenInfo,
|
|
299
|
+
componentName: 'Button',
|
|
300
|
+
}}>
|
|
301
|
+
<TouchableOpacity
|
|
302
|
+
{...rest}
|
|
303
|
+
accessibilityLabel={`Button/${title}`}
|
|
304
|
+
activeOpacity={activeOpacity}
|
|
305
|
+
onPress={onPressButton}
|
|
306
|
+
style={buttonStyle}>
|
|
307
|
+
{renderLeading()}
|
|
308
|
+
{renderTitle()}
|
|
309
|
+
{renderTrailing()}
|
|
310
|
+
{gradientPros && (
|
|
311
|
+
<AnimationLinear {...gradientPros} style={styles.gradientView} />
|
|
312
|
+
)}
|
|
313
|
+
{gradientPros && <View style={styles.strokeView} />}
|
|
314
|
+
</TouchableOpacity>
|
|
315
|
+
</ScreenContext.Provider>
|
|
308
316
|
);
|
|
309
317
|
};
|
|
310
318
|
|
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,
|