@momo-kits/foundation 0.169.4-beta.6 → 0.169.4-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.
@@ -1,14 +1,12 @@
1
- import React, { useContext, useState, useSyncExternalStore } from 'react';
1
+ import React, { useState, useSyncExternalStore } from 'react';
2
2
  import { Share, TouchableOpacity, View } from 'react-native';
3
3
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
4
4
 
5
5
  import { Colors, Spacing } from '../../Consts';
6
- import { MiniAppContext } from '../../Context';
7
6
  import { Text } from '../../Text';
8
7
  import { adoptionStore } from './AdoptionStore';
9
8
  import { styles } from './styles';
10
9
  import type { ScreenSnapshot } from './types';
11
- import { isAdoptionEnabled } from './utils';
12
10
 
13
11
  /** Subscribes a React listener to the adoption store. Stable identity for useSyncExternalStore. */
14
12
  const subscribeToStore = (listener: () => void): (() => void) =>
@@ -49,17 +47,15 @@ const handleClear = (): void => {
49
47
 
50
48
  /**
51
49
  * Dev-only floating badge showing the latest screen's kit adoption. Tap to
52
- * expand actions (re-measure, share JSON, clear). Renders nothing in release
53
- * builds or when kit adoption is off.
50
+ * expand actions (re-measure, share JSON, clear). Renders nothing in release builds.
54
51
  */
55
52
  const AdoptionBadge: React.FC = () => {
56
- const context = useContext<unknown>(MiniAppContext);
57
53
  const insets = useSafeAreaInsets();
58
54
  const [isExpanded, setExpanded] = useState(false);
59
55
  const latest = useSyncExternalStore(subscribeToStore, getLatestSnapshot);
60
56
  const screenCount = useSyncExternalStore(subscribeToStore, getScreenCount);
61
57
 
62
- if (!__DEV__ || !isAdoptionEnabled(context)) return null;
58
+ if (!__DEV__) return null;
63
59
 
64
60
  const handleToggle = (): void => setExpanded(prev => !prev);
65
61
 
@@ -14,7 +14,6 @@ import {
14
14
  createRegistries,
15
15
  getAppId,
16
16
  getCurrentFiber,
17
- isAdoptionEnabled,
18
17
  walkScreen,
19
18
  } from './utils';
20
19
 
@@ -75,7 +74,7 @@ const PassThrough = (props: ProbeProps): React.JSX.Element => (
75
74
 
76
75
  /**
77
76
  * Dev-only wrapper around a screen. Measures the screen's fiber tree after
78
- * the first interactions settle, and again on focus, when kit adoption is on.
77
+ * the first interactions settle, and again on focus. Release builds use PassThrough.
79
78
  */
80
79
  class AdoptionProbeDev extends React.Component<ProbeProps> {
81
80
  static contextType = MiniAppContext;
@@ -85,7 +84,6 @@ class AdoptionProbeDev extends React.Component<ProbeProps> {
85
84
  private unsubscribeFocus: (() => void) | undefined;
86
85
 
87
86
  componentDidMount(): void {
88
- if (!isAdoptionEnabled(this.context)) return;
89
87
  adoptionStore.setActive(this.measure);
90
88
  this.unsubscribeFocus = this.props.navigation?.addListener?.(
91
89
  'focus',
@@ -180,12 +180,6 @@ const isHostDefined = (fiber: FiberLike): boolean => {
180
180
  return !!child && !isAppAuthored(child) && child._debugOwner === fiber;
181
181
  };
182
182
 
183
- /** True when the mini-app context opted into kit adoption measurement. */
184
- const isAdoptionEnabled = (context: unknown): boolean =>
185
- isObjectLike(context) &&
186
- isObjectLike(context.features) &&
187
- context.features.kitAdoption === true;
188
-
189
183
  /** App id from the mini-app context, or a placeholder when it is missing. */
190
184
  const getAppId = (context: unknown): string => {
191
185
  if (!isObjectLike(context) || context.appId == null) return UNKNOWN_APP_ID;
@@ -392,7 +386,6 @@ export {
392
386
  getAuthorFiber,
393
387
  getCurrentFiber,
394
388
  getTypeName,
395
- isAdoptionEnabled,
396
389
  isAppAuthored,
397
390
  isHostDefined,
398
391
  unwrapType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/foundation",
3
- "version": "0.169.4-beta.6",
3
+ "version": "0.169.4-beta.8",
4
4
  "description": "React Native Component Kits",
5
5
  "main": "index.ts",
6
6
  "scripts": {},