@onekeyfe/react-native-perf-stats 3.0.28 → 3.0.29

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.
@@ -593,7 +593,11 @@ internal object Overlay : Application.ActivityLifecycleCallbacks {
593
593
  val view = overlayView ?: return
594
594
  if (attachedToWindowManager) {
595
595
  try {
596
- val wm = currentActivity?.getSystemService(Context.WINDOW_SERVICE)
596
+ // Use the view's own context, not currentActivity. onActivityDestroyed
597
+ // posts detach() to the main handler and then clears currentActivity
598
+ // synchronously, so by the time this runs currentActivity may already
599
+ // be null and the overlay would otherwise leak.
600
+ val wm = view.context.getSystemService(Context.WINDOW_SERVICE)
597
601
  as? WindowManager
598
602
  wm?.removeView(view)
599
603
  } catch (e: Exception) {
@@ -43,9 +43,13 @@ export interface ReactNativePerfStats extends HybridObject<{
43
43
  /**
44
44
  * Show the floating overlay (CPU + RAM) drawn natively.
45
45
  *
46
- * - Android: TextView attached to the current Activity via
47
- * `addContentView` no floating-window permission required.
48
- * - iOS: UILabel added to the key UIWindow.
46
+ * - Android: TextView attached via `WindowManager.addView` using the
47
+ * current Activity's window token (window type
48
+ * `TYPE_APPLICATION_ABOVE_SUB_PANEL`) no floating-window permission
49
+ * required, and the overlay tracks Activity lifecycle (re-attach on
50
+ * resume, detach on pause/destroy).
51
+ * - iOS: UILabel hosted on a dedicated passthrough UIWindow above the
52
+ * app's key window so it stays above modally-presented controllers.
49
53
  * - Draggable on both platforms.
50
54
  * - Idempotent. If the sampler is not running, the overlay shows "--"
51
55
  * until `start` is called.
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNativePerfStats.nitro.d.ts","sourceRoot":"","sources":["../../../src/ReactNativePerfStats.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;I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AAI,CAAC;IAEhC,+EAA+E;IAC/E,IAAI,IAAI,IAAI,CAAC;IAEb;;;;;;;;;;;;;OAaG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB,gFAAgF;IAChF,WAAW,IAAI,IAAI,CAAC;IAEpB;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9B;;;;;;;;OAQG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-perf-stats",
3
- "version": "3.0.28",
3
+ "version": "3.0.29",
4
4
  "description": "react-native-perf-stats",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -45,9 +45,13 @@ export interface ReactNativePerfStats
45
45
  /**
46
46
  * Show the floating overlay (CPU + RAM) drawn natively.
47
47
  *
48
- * - Android: TextView attached to the current Activity via
49
- * `addContentView` no floating-window permission required.
50
- * - iOS: UILabel added to the key UIWindow.
48
+ * - Android: TextView attached via `WindowManager.addView` using the
49
+ * current Activity's window token (window type
50
+ * `TYPE_APPLICATION_ABOVE_SUB_PANEL`) no floating-window permission
51
+ * required, and the overlay tracks Activity lifecycle (re-attach on
52
+ * resume, detach on pause/destroy).
53
+ * - iOS: UILabel hosted on a dedicated passthrough UIWindow above the
54
+ * app's key window so it stays above modally-presented controllers.
51
55
  * - Draggable on both platforms.
52
56
  * - Idempotent. If the sampler is not running, the overlay shows "--"
53
57
  * until `start` is called.