@datadog/mobile-react-native-session-replay 3.1.1 → 3.2.0

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,7 +23,7 @@ Pod::Spec.new do |s|
23
23
  s.dependency "React-Core"
24
24
 
25
25
  # /!\ Remember to keep the version in sync with DatadogSDKReactNative.podspec
26
- s.dependency 'DatadogSessionReplay', '3.5.0'
26
+ s.dependency 'DatadogSessionReplay', '3.8.2'
27
27
  s.dependency 'DatadogSDKReactNative'
28
28
 
29
29
  s.test_spec 'Tests' do |test_spec|
@@ -216,8 +216,8 @@ dependencies {
216
216
  api "com.facebook.react:react-android:$reactNativeVersion"
217
217
  }
218
218
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
219
- implementation "com.datadoghq:dd-sdk-android-session-replay:3.5.0"
220
- implementation "com.datadoghq:dd-sdk-android-internal:3.5.0"
219
+ implementation "com.datadoghq:dd-sdk-android-session-replay:3.8.0"
220
+ implementation "com.datadoghq:dd-sdk-android-internal:3.8.0"
221
221
  implementation project(path: ':datadog_mobile-react-native')
222
222
 
223
223
  testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
@@ -31,7 +31,7 @@
31
31
  RCTTextView* textView = (RCTTextView*)view;
32
32
  NSNumber* tag = textView.reactTag;
33
33
 
34
- __block RCTTextShadowView* shadowView = nil;
34
+ __block RCTTextPropertiesWrapper* textProperties = nil;
35
35
  NSTimeInterval timeout = 0.2;
36
36
  dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
37
37
 
@@ -41,8 +41,33 @@
41
41
  // That would create a circular dependency and deadlock the app.
42
42
  // To avoid this, we dispatch the work asynchronously to the UIManager queue and wait with a timeout.
43
43
  // This ensures we block only if absolutely necessary, and can fail gracefully if the queue is busy.
44
+ //
45
+ // All shadow view property reads (reactSubviews, textAttributes, layoutMetrics) must also happen
46
+ // on the UIManager queue. The UIManager queue can mutate or deallocate shadow views and their
47
+ // subviews at any time, so reading them on the main thread after the semaphore is signaled creates
48
+ // a race condition that causes SIGSEGV crashes in objc_msgSend.
44
49
  dispatch_async(uiManager.methodQueue, ^{
45
- shadowView = (RCTTextShadowView*)[uiManager shadowViewForReactTag:tag];
50
+ RCTTextShadowView* shadowView = (RCTTextShadowView*)[uiManager shadowViewForReactTag:tag];
51
+
52
+ if (shadowView != nil && [shadowView isKindOfClass:[RCTTextShadowView class]]) {
53
+ RCTTextPropertiesWrapper* wrapper = [[RCTTextPropertiesWrapper alloc] init];
54
+
55
+ NSString* text = [self tryToExtractTextFromSubViews:shadowView.reactSubviews];
56
+ if (text != nil) {
57
+ wrapper.text = text;
58
+ }
59
+
60
+ if (shadowView.textAttributes.foregroundColor != nil) {
61
+ wrapper.foregroundColor = shadowView.textAttributes.foregroundColor;
62
+ }
63
+
64
+ wrapper.alignment = shadowView.textAttributes.alignment;
65
+ wrapper.fontSize = shadowView.textAttributes.fontSize;
66
+ wrapper.contentRect = shadowView.layoutMetrics.contentFrame;
67
+
68
+ textProperties = wrapper;
69
+ }
70
+
46
71
  dispatch_semaphore_signal(semaphore);
47
72
  });
48
73
 
@@ -53,27 +78,6 @@
53
78
  return nil;
54
79
  }
55
80
 
56
- if (shadowView == nil || ![shadowView isKindOfClass:[RCTTextShadowView class]]) {
57
- return nil;
58
- }
59
-
60
- RCTTextPropertiesWrapper* textProperties = [[RCTTextPropertiesWrapper alloc] init];
61
-
62
- // Extract text from subviews
63
- NSString* text = [self tryToExtractTextFromSubViews:shadowView.reactSubviews];
64
- if (text != nil) {
65
- textProperties.text = text;
66
- }
67
-
68
- // Extract text attributes
69
- if (shadowView.textAttributes.foregroundColor != nil) {
70
- textProperties.foregroundColor = shadowView.textAttributes.foregroundColor;
71
- }
72
-
73
- textProperties.alignment = shadowView.textAttributes.alignment;
74
- textProperties.fontSize = shadowView.textAttributes.fontSize;
75
- textProperties.contentRect = shadowView.layoutMetrics.contentFrame;
76
-
77
81
  return textProperties;
78
82
  #else
79
83
  return nil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native-session-replay",
3
- "version": "3.1.1",
3
+ "version": "3.2.0",
4
4
  "description": "A client-side React Native module to enable session replay with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -96,5 +96,5 @@
96
96
  "dependencies": {
97
97
  "chokidar": "^4.0.3"
98
98
  },
99
- "gitHead": "5d7701cabda497319391937073b2456dc83a0e62"
99
+ "gitHead": "f536944e1d1f58d7e75b28bbed9dfb99288e1816"
100
100
  }