@momo-kits/foundation 0.81.3 → 0.81.5-beta.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.
@@ -23,6 +23,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
23
23
  options,
24
24
  maxApi,
25
25
  localization,
26
+ miniAppInfo,
26
27
  }) => {
27
28
  const navigationRef = React.useRef<NavigationContainerRef>(null);
28
29
  const navigator = useRef(new Navigator(navigationRef));
@@ -73,6 +74,7 @@ const NavigationContainer: React.FC<NavigationContainerProps> = ({
73
74
  showGrid,
74
75
  language,
75
76
  translate,
77
+ appInfo: miniAppInfo,
76
78
  }}>
77
79
  <ReactNavigationContainer
78
80
  theme={{
@@ -1,12 +1,18 @@
1
- import React, {useContext, useLayoutEffect} from 'react';
1
+ import React, {useContext, useEffect, useLayoutEffect} from 'react';
2
2
  import {ScreenParams} from './types';
3
3
  import Navigation from './Navigation';
4
4
  import {ApplicationContext} from './index';
5
5
  import {GridSystem} from '../Layout';
6
6
 
7
+ const TRIGGER_ID = '111378000000000000';
8
+
7
9
  const StackScreen: React.FC<ScreenParams> = props => {
8
- const {screen: Component, options}: ScreenParams = props.route.params;
9
- const {theme, showGrid} = useContext(ApplicationContext);
10
+ const {
11
+ screen: Component,
12
+ options,
13
+ tracking,
14
+ }: ScreenParams = props.route.params;
15
+ const {theme, showGrid, navigator, appInfo} = useContext(ApplicationContext);
10
16
  const navigation = new Navigation(props.navigation, theme);
11
17
 
12
18
  const params = {
@@ -16,6 +22,25 @@ const StackScreen: React.FC<ScreenParams> = props => {
16
22
 
17
23
  delete params.screen;
18
24
 
25
+ const navigationRoutes = props.navigation.getState()?.routes || [];
26
+ const routesLength = navigationRoutes.length;
27
+ let pre_screen_name = navigationRoutes?.[0]?.params?.screen?.name;
28
+ if (routesLength > 1) {
29
+ pre_screen_name = navigationRoutes[routesLength - 2]?.params?.screen?.name;
30
+ }
31
+
32
+ useEffect(() => {
33
+ if (appInfo) {
34
+ navigator?.maxApi?.trackEvent('service_frame_displayed', {
35
+ ...appInfo,
36
+ screen_name: Component.name,
37
+ flow_partner_id: tracking?.flow_partner_id,
38
+ pre_screen_name,
39
+ trigger_id: TRIGGER_ID,
40
+ });
41
+ }
42
+ }, []);
43
+
19
44
  useLayoutEffect(() => {
20
45
  if (options) {
21
46
  navigation.setOptions(options);
@@ -68,6 +68,7 @@ export type Context = {
68
68
  showGrid?: boolean;
69
69
  language?: 'vi' | 'en';
70
70
  translate?: (key: string) => string;
71
+ appInfo: MiniAppInfo;
71
72
  };
72
73
 
73
74
  export type LocalizationObject = {
@@ -79,12 +80,19 @@ export type LocalizationObject = {
79
80
  };
80
81
  };
81
82
 
83
+ export type MiniAppInfo = {
84
+ feature_code: string;
85
+ app_id: string;
86
+ miniapp_version: number;
87
+ };
88
+
82
89
  export type NavigationContainerProps = {
83
90
  screen: Screen;
84
91
  options?: NavigationOptions;
85
92
  theme: Theme;
86
- maxApi?: any;
93
+ maxApi: any;
87
94
  localization?: LocalizationObject;
95
+ miniAppInfo: MiniAppInfo;
88
96
  };
89
97
 
90
98
  export type NavigationScreenProps = {
@@ -97,6 +105,7 @@ export type ScreenParams = {
97
105
  [key: string]: any;
98
106
  screen: Screen;
99
107
  options?: NavigationOptions;
108
+ tracking?: any;
100
109
  };
101
110
 
102
111
  export interface ModalParams extends ScreenParams {
@@ -125,9 +134,7 @@ export interface NavigationOptions extends StackNavigationOptions {
125
134
  onPressLeftHeader?: () => void;
126
135
  surface?: boolean;
127
136
  hiddenBack?: boolean;
128
- headerTitleAlign?: 'left' | 'center';
129
137
  customTitle?: TitleCustomProps;
130
- animatedValue?: Animated.Value;
131
138
  }
132
139
 
133
140
  export interface HeaderBackProps extends NavigationButtonProps {
@@ -2,11 +2,13 @@ import React, {FC, ReactElement, useContext} from 'react';
2
2
  import {FlatList, FlatListProps, View} from 'react-native';
3
3
  import Item from './Item';
4
4
  import {GridContext} from './index';
5
+ import styles from './styles';
5
6
 
6
7
  const ItemList: FC<FlatListProps<any>> = ({
7
8
  renderItem,
8
9
  numColumns = 1,
9
10
  style,
11
+ contentContainerStyle,
10
12
  ...props
11
13
  }) => {
12
14
  const {gutterSize} = useContext(GridContext);
@@ -43,21 +45,8 @@ const ItemList: FC<FlatListProps<any>> = ({
43
45
  renderItem={_renderItem}
44
46
  horizontal={false}
45
47
  ItemSeparatorComponent={() => <View style={{height: gutterSize}} />}
46
- style={[
47
- style,
48
- {
49
- marginTop: undefined,
50
- marginBottom: undefined,
51
- marginLeft: undefined,
52
- marginRight: undefined,
53
- paddingTop: undefined,
54
- paddingBottom: undefined,
55
- paddingLeft: undefined,
56
- paddingRight: undefined,
57
- padding: undefined,
58
- margin: undefined,
59
- },
60
- ]}
48
+ style={[style, styles.protectedStyle]}
49
+ contentContainerStyle={[contentContainerStyle, styles.protectedStyle]}
61
50
  />
62
51
  );
63
52
  };
package/Layout/Screen.tsx CHANGED
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  Animated,
3
- Image,
4
3
  KeyboardAvoidingView,
5
4
  NativeScrollEvent,
6
5
  NativeSyntheticEvent,
@@ -28,6 +27,7 @@ import {
28
27
  import Navigation from '../Application/Navigation';
29
28
  import styles from './styles';
30
29
  import {AnimatedHeader, NavigationOptions} from '../Application/types';
30
+ import {Image} from '../Image';
31
31
 
32
32
  export interface ScreenProps extends ViewProps {
33
33
  children: React.ReactNode;
@@ -259,6 +259,7 @@ const Screen = forwardRef(
259
259
  uri: headerBackground,
260
260
  }}
261
261
  style={styles.extendedHeader}
262
+ loading={false}
262
263
  />
263
264
  <View style={{height: heightHeader}} />
264
265
  </>
package/Layout/styles.ts CHANGED
@@ -77,4 +77,20 @@ export default StyleSheet.create({
77
77
  right: 0,
78
78
  borderRadius: Spacing.M,
79
79
  },
80
+ protectedStyle: {
81
+ marginTop: undefined,
82
+ marginBottom: undefined,
83
+ marginLeft: undefined,
84
+ marginRight: undefined,
85
+ paddingTop: undefined,
86
+ paddingBottom: undefined,
87
+ paddingLeft: undefined,
88
+ paddingRight: undefined,
89
+ padding: undefined,
90
+ margin: undefined,
91
+ marginHorizontal: undefined,
92
+ marginVertical: undefined,
93
+ paddingHorizontal: undefined,
94
+ paddingVertical: undefined,
95
+ },
80
96
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.81.3",
3
+ "version": "0.81.5-beta.1",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -42,4 +42,4 @@
42
42
  },
43
43
  "author": "@momo-kits/foundation",
44
44
  "license": "ISC"
45
- }
45
+ }