@momo-kits/foundation 0.112.1-optimize.6-beta.7 → 0.112.1-optimize.6-beta.8

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.
@@ -28,6 +28,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
28
28
  timeLoad: 0,
29
29
  timeInteraction: 0,
30
30
  widgets: [],
31
+ params: undefined,
31
32
  });
32
33
  const widgets = useRef<any>([]);
33
34
  const context = useContext<any>(MiniAppContext);
@@ -117,6 +118,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
117
118
  state: 'load',
118
119
  duration: timeLoad,
119
120
  widgets: tracking.current.widgets,
121
+ params: tracking.current.params,
120
122
  });
121
123
  navigator?.maxApi?.stopTrace?.(
122
124
  tracking.current.traceIdLoad,
@@ -165,6 +167,7 @@ const StackScreen: React.FC<ScreenParams> = props => {
165
167
  state: 'interaction',
166
168
  duration: tracking.current.timeInteraction - timeLoad,
167
169
  totalDuration: tracking.current.timeInteraction,
170
+ params: tracking.current.params,
168
171
  });
169
172
  navigator?.maxApi?.stopTrace?.(
170
173
  tracking.current.traceIdInteraction,
@@ -254,6 +257,9 @@ const StackScreen: React.FC<ScreenParams> = props => {
254
257
  onScreenInteraction();
255
258
  }, 2000);
256
259
  },
260
+ onSetParams: (data: any) => {
261
+ tracking.current.params = data;
262
+ },
257
263
  }}>
258
264
  <Component heightHeader={heightHeader} {...data} />
259
265
  {showGrid && <GridSystem />}
package/Layout/Screen.tsx CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  ViewProps,
24
24
  } from 'react-native';
25
25
  import {useSafeAreaInsets} from 'react-native-safe-area-context';
26
- import {ApplicationContext} from '../Application';
26
+ import {ApplicationContext, ScreenContext} from '../Application';
27
27
  import Navigation from '../Application/Navigation';
28
28
  import {
29
29
  AnimatedHeader,
@@ -148,6 +148,11 @@ export interface ScreenProps extends ViewProps {
148
148
  * Optional. Custom headerBackground Image
149
149
  */
150
150
  headerBackground?: string;
151
+
152
+ /**
153
+ * Optional. Custom tracking params
154
+ */
155
+ trackingParams?: object;
151
156
  }
152
157
 
153
158
  const Screen = forwardRef(
@@ -174,11 +179,13 @@ const Screen = forwardRef(
174
179
  animatedValue: customAnimatedValue,
175
180
  headerBackground,
176
181
  gradientColor,
182
+ trackingParams,
177
183
  }: ScreenProps,
178
184
  ref: any
179
185
  ) => {
180
186
  const screenRef = useRef<View | ScrollView>();
181
187
  const {theme} = useContext(ApplicationContext);
188
+ const screen: any = useContext(ScreenContext);
182
189
  const insets = useSafeAreaInsets();
183
190
  const heightHeader = useHeaderHeight();
184
191
  const animatedValue = useRef<Animated.Value>(
@@ -195,6 +202,11 @@ const Screen = forwardRef(
195
202
  keyboardOffset = -Math.min(insets.bottom, 21);
196
203
  }
197
204
 
205
+ /**
206
+ * inject params for screen tracking
207
+ */
208
+ screen?.onSetParams?.(trackingParams);
209
+
198
210
  /**
199
211
  * export options for screen
200
212
  * @param headerType
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.112.1-optimize.6-beta.7",
3
+ "version": "0.112.1-optimize.6-beta.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},