@coralogix/react-native-plugin 0.7.0 → 0.7.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/android/src/main/java/com/cxsdk/CxSdkModule.kt +13 -5
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/ios/CxSdk.swift +24 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -467,7 +467,7 @@ import { SessionReplay } from '@coralogix/react-native-plugin';
|
|
|
467
467
|
</View>
|
|
468
468
|
```
|
|
469
469
|
|
|
470
|
-
The `SessionReplay.maskView` function accepts a `LayoutChangeEvent` and will mask the view in session replay recordings.
|
|
470
|
+
The `SessionReplay.maskView` function accepts a `LayoutChangeEvent` and will mask the view in session replay recordings. It works on both the legacy and the New Architecture (Fabric).
|
|
471
471
|
|
|
472
472
|
|
|
473
473
|
### Optional - Coralogix Gradle Plugin (Android)
|
|
@@ -43,7 +43,8 @@ import com.facebook.react.bridge.WritableMap
|
|
|
43
43
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
44
44
|
import org.json.JSONArray
|
|
45
45
|
import org.json.JSONObject
|
|
46
|
-
import com.facebook.react.
|
|
46
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
47
|
+
import com.facebook.react.uimanager.UIManagerHelper
|
|
47
48
|
import java.util.concurrent.ConcurrentHashMap
|
|
48
49
|
|
|
49
50
|
class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
@@ -311,11 +312,18 @@ class CxSdkModule(reactContext: ReactApplicationContext) :
|
|
|
311
312
|
|
|
312
313
|
@ReactMethod
|
|
313
314
|
override fun maskViewByTag(viewTag: Int) {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
315
|
+
// Resolve the view through the architecture-agnostic UIManagerHelper so this
|
|
316
|
+
// works on both the legacy (Paper) and New (Fabric) architectures.
|
|
317
|
+
// getNativeModule(UIManagerModule) only exists on Paper; under Fabric it
|
|
318
|
+
// returns null and masking silently no-ops. UIManagerHelper routes by tag:
|
|
319
|
+
// legacy tags -> UIManagerModule, Fabric tags -> FabricUIManager, both
|
|
320
|
+
// exposing UIManager.resolveView(tag).
|
|
321
|
+
val context = reactApplicationContext
|
|
322
|
+
// FabricUIManager.resolveView must be called on the UI thread.
|
|
323
|
+
UiThreadUtil.runOnUiThread {
|
|
317
324
|
try {
|
|
318
|
-
val
|
|
325
|
+
val uiManager = UIManagerHelper.getUIManagerForReactTag(context, viewTag)
|
|
326
|
+
val view = uiManager?.resolveView(viewTag)
|
|
319
327
|
view?.maskView()
|
|
320
328
|
} catch (t: Throwable) {
|
|
321
329
|
t.printStackTrace()
|
package/index.cjs.js
CHANGED
package/index.esm.js
CHANGED
package/ios/CxSdk.swift
CHANGED
|
@@ -351,25 +351,34 @@ class CxSdk: RCTEventEmitter {
|
|
|
351
351
|
func maskViewByTag(viewTag: NSNumber,
|
|
352
352
|
resolve:@escaping RCTPromiseResolveBlock,
|
|
353
353
|
reject:@escaping RCTPromiseRejectBlock) -> Void {
|
|
354
|
-
guard
|
|
355
|
-
|
|
356
|
-
let uiManager = bridge.uiManager
|
|
357
|
-
else {
|
|
358
|
-
reject("MASK_VIEW_ERROR", "no ui manager found, aborting maskViewByTag", nil)
|
|
354
|
+
guard let bridge = RCTBridge.current() else {
|
|
355
|
+
reject("MASK_VIEW_ERROR", "no bridge found, aborting maskViewByTag", nil)
|
|
359
356
|
return
|
|
360
357
|
}
|
|
361
358
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
359
|
+
// View resolution and the cxMask mutation must happen on the main thread.
|
|
360
|
+
DispatchQueue.main.async {
|
|
361
|
+
// New Architecture (Fabric): mounted views live in the component-view
|
|
362
|
+
// registry, not the legacy RCTUIManager registry. Resolve them via the
|
|
363
|
+
// surface presenter; without this, masking silently no-ops on Fabric.
|
|
364
|
+
// The presenter is typed non-null but is absent on the legacy
|
|
365
|
+
// architecture, so bind it through an optional before use.
|
|
366
|
+
let surfacePresenter: (any RCTSurfacePresenterStub)? = bridge.surfacePresenter()
|
|
367
|
+
if let surfacePresenter = surfacePresenter,
|
|
368
|
+
let view = surfacePresenter.findComponentView(withTag_DO_NOT_USE_DEPRECATED: viewTag.intValue) {
|
|
369
|
+
view.cxMask = true
|
|
370
|
+
resolve("view with tag \(viewTag) marked for masking")
|
|
371
|
+
return
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// Legacy (Paper) architecture.
|
|
375
|
+
if let view = bridge.uiManager?.view(forReactTag: viewTag) {
|
|
376
|
+
view.cxMask = true
|
|
377
|
+
resolve("view with tag \(viewTag) marked for masking")
|
|
378
|
+
return
|
|
372
379
|
}
|
|
380
|
+
|
|
381
|
+
reject("MASK_VIEW_ERROR", "view with tag \(viewTag) not found, aborting maskViewByTag", nil)
|
|
373
382
|
}
|
|
374
383
|
}
|
|
375
384
|
|