Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RUM-8908] SR: Fixed Android build issue for RN <= 0.68 #819

Merged
merged 1 commit into from
Mar 13, 2025

Conversation

marco-saia-datadog
Copy link
Member

@marco-saia-datadog marco-saia-datadog commented Mar 12, 2025

What does this PR do?

Fixes a Session Replay Android build error that occurs for RN <= 0.68.

The issue is caused by ReactViewBackgroundDrawable method getBorderColor being private prior to RN 0.69. In order to fix it we leverage reflection to access the private attributes and resolve the border color on our side.

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

Sorry, something went wrong.

@datadog-datadog-prod-us1
Copy link

Datadog Report

Branch report: marcosaia/RUM-8908/fix-sr-android-build
Commit report: 1d36c99
Test service: dd-sdk-reactnative

✅ 0 Failed, 651 Passed, 1 Skipped, 12.35s Total Time

@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-8908/fix-sr-android-build branch from 1d36c99 to e6eecb4 Compare March 12, 2025 16:00
@marco-saia-datadog marco-saia-datadog marked this pull request as ready for review March 12, 2025 16:37
@marco-saia-datadog marco-saia-datadog requested a review from a team as a code owner March 12, 2025 16:37
sbarrio
sbarrio previously approved these changes Mar 12, 2025
Copy link
Contributor

@sbarrio sbarrio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!, just left a minor suggestion.

Comment on lines +73 to +81
val borderRgb = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_RGB_FIELD_NAME
) as Spacing?

val borderAlpha = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_ALPHA_FIELD_NAME
) as Spacing?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val borderRgb = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_RGB_FIELD_NAME
) as Spacing?
val borderAlpha = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_ALPHA_FIELD_NAME
) as Spacing?
val borderRgb = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_RGB_FIELD_NAME
) as? Spacing
val borderAlpha = reflectionUtils.getDeclaredField(
backgroundDrawable,
BORDER_ALPHA_FIELD_NAME
) as? Spacing

return reflectionUtils.getDeclaredField(
backgroundDrawable,
COLOR_FIELD_NAME
) as Int?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
) as Int?
) as? Int

0xnm
0xnm previously approved these changes Mar 13, 2025
sbarrio
sbarrio previously approved these changes Mar 13, 2025
@marco-saia-datadog marco-saia-datadog dismissed stale reviews from sbarrio and 0xnm via e6eecb4 March 13, 2025 09:29
@marco-saia-datadog marco-saia-datadog force-pushed the marcosaia/RUM-8908/fix-sr-android-build branch from 7a08174 to e6eecb4 Compare March 13, 2025 09:29
@cdn34dd cdn34dd self-requested a review March 13, 2025 09:57
@marco-saia-datadog marco-saia-datadog merged commit 6d6700e into develop Mar 13, 2025
8 of 9 checks passed
@marco-saia-datadog marco-saia-datadog deleted the marcosaia/RUM-8908/fix-sr-android-build branch March 13, 2025 09:59
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.

None yet

4 participants