@datadog/mobile-react-native-session-replay 2.3.4-alpha.0 → 2.3.6-alpha.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.
@@ -67,6 +67,11 @@ internal class ReactTextPropertiesResolver(
67
67
  pixelDensity: Float,
68
68
  ):
69
69
  Pair<MobileSegment.TextStyle, MobileSegment.TextPosition>? {
70
+
71
+ if (!reactContext.hasActiveReactInstance()) {
72
+ return null
73
+ }
74
+
70
75
  val shadowNodeWrapper: ShadowNodeWrapper =
71
76
  ShadowNodeWrapper.getShadowNodeWrapper(
72
77
  reactContext = reactContext,
@@ -103,6 +103,7 @@ internal class ReactTextPropertiesResolverTest {
103
103
  whenever(mockReactContext.runOnNativeModulesQueueThread(any())).thenAnswer {
104
104
  (it.arguments[0] as Runnable).run()
105
105
  }
106
+ whenever(mockReactContext.hasActiveReactInstance()).thenReturn(true)
106
107
 
107
108
  testedResolver = ReactTextPropertiesResolver(
108
109
  reactContext = mockReactContext,
@@ -290,5 +291,19 @@ internal class ReactTextPropertiesResolverTest {
290
291
  assertThat(result.textStyle.color).isEqualTo(fakeWireframe.textStyle.color)
291
292
  }
292
293
 
294
+ @Test
295
+ fun `M return legacy textStyle W addReactNativeProperties() { no valid react context }`() {
296
+ // Given
297
+ whenever(mockReactContext.hasActiveReactInstance()).thenReturn(false)
298
+ whenever(mockReflectionUtils.getDeclaredField(mockShadowNode, FONT_FAMILY_FIELD_NAME))
299
+ .thenReturn(MONOSPACE_FAMILY_NAME)
300
+
301
+ // When
302
+ val result = testedResolver.addReactNativeProperties(fakeWireframe, mockTextView, 0f)
303
+
304
+ // Then
305
+ assertThat(result.textStyle.family).isNotEqualTo(MONOSPACE_FAMILY_NAME)
306
+ }
307
+
293
308
  // endregion
294
309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native-session-replay",
3
- "version": "2.3.4-alpha.0",
3
+ "version": "2.3.6-alpha.0",
4
4
  "description": "A client-side React Native module to enable session replay with Datadog",
5
5
  "keywords": [
6
6
  "datadog",