Skip to content

[RUM-9424] Session Replay support for RN 0.79#851

Merged
marco-saia-datadog merged 1 commit into
developfrom
marcosaia/RUM-9424/support-rn-79
Apr 15, 2025
Merged

[RUM-9424] Session Replay support for RN 0.79#851
marco-saia-datadog merged 1 commit into
developfrom
marcosaia/RUM-9424/support-rn-79

Conversation

@marco-saia-datadog
Copy link
Copy Markdown
Member

What does this PR do?

Fixes breaking change in Android Session Replay introduced by RN 0.79.

What changed

The property drawable.borderRadius.uniform is not accessible anymore, as BorderRadiusStyle has been made internal in RN 0.79.

This PR uses reflection to access the same property:

    @OptIn(UnstableReactNativeAPI::class)
    private fun getBorderRadius(drawable: CSSBackgroundDrawable): Float {
        val width = drawable.intrinsicWidth.toFloat()
        val height = drawable.intrinsicHeight.toFloat()
        val uniform = getBorderRadiusUniform(drawable)
        return uniform?.getRadius(width, height) ?: 0f
    }

    @OptIn(UnstableReactNativeAPI::class)
    private fun getBorderRadiusUniform(
        drawable: CSSBackgroundDrawable
    ): LengthPercentage? {
        return reflectionUtils.getDeclaredField(
            drawable.borderRadius,
            UNIFORM_FIELD_NAME
        ) as? LengthPercentage
    }

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner April 14, 2025 10:42
@datadog-datadog-prod-us1
Copy link
Copy Markdown

Datadog Report

Branch report: marcosaia/RUM-9424/support-rn-79
Commit report: bdf3d0d
Test service: dd-sdk-reactnative

✅ 0 Failed, 668 Passed, 1 Skipped, 3.67s Total Time

@marco-saia-datadog marco-saia-datadog changed the title [FEAT] Session Replay support for RN 0.79 [RUM-9424] Session Replay support for RN 0.79 Apr 14, 2025
@marco-saia-datadog marco-saia-datadog merged commit 4095c48 into develop Apr 15, 2025
8 checks passed
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/RUM-9424/support-rn-79 branch April 15, 2025 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants