Skip to content

[RUMS-18012] [RN 0.87] fix: 'RCTParagraphComponentView.h' file not found - #1365

Closed
marco-saia-datadog wants to merge 3 commits into
developfrom
marcosaia/rums-18012/rn-87-support
Closed

[RUMS-18012] [RN 0.87] fix: 'RCTParagraphComponentView.h' file not found#1365
marco-saia-datadog wants to merge 3 commits into
developfrom
marcosaia/rums-18012/rn-87-support

Conversation

@marco-saia-datadog

Copy link
Copy Markdown
Member

What does this PR do?

Building the iOS app on a React Native 0.87 project with @datadog/mobile-react-native-session-replay fails with:

.../node_modules/@datadog/mobile-react-native-session-replay/ios/Sources/RCTFabricWrapper.mm:11:9
'RCTParagraphComponentView.h' file not found

Root cause

RN 0.87 introduces a new prebuilt React Native core CocoaPods facade mechanism (node_modules/react-native/scripts/cocoapods/rncore_facades.rb). It replaces several pods real podspecs, including React-RCTFabric, with an empty placeholder pod whose headers live inside the prebuilt React.xcframework. No public headers are exposed anymore except those from a narrow allowlist (FACADE_REEXPOSED_HEADERS), which today only contains RCTFabricComponentsPlugins.h.

RCTFabricWrapper.mm in packages/react-native-session-replay/ios/Sources/ quote-imports some headers from React-RCTFabric, that are not on the facade allowlist:

  • RCTParagraphComponentView.h
  • RCTConversions.h (only needed for the RCT_VERSION_MINOR <= 73)

Fix

Since we can't change RN's facade allowlist, the fix must be applied on our side: stop relying on CocoaPods quoted-header resolution of React-RCTFabric-internal types:

  • Resolve RCTParagraphComponentView dynamically via NSClassFromString instead of the compile-time class symbol (removes the header import entirely).

  • Read attributedText via KVC instead of a direct property access.

  • Call -props via a raw IMP looked up with methodForSelector:

  • Guard #import "RCTConversions.h" behind #if RCT_VERSION_MINOR <= 73 matching the only branch that actually needs it.

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

Copilot AI lite review requested due to automatic review settings August 12, 2026 09:23
@marco-saia-datadog
marco-saia-datadog requested a review from a team as a code owner August 12, 2026 09:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes build failures on iOS for React Native 0.87 projects using @datadog/mobile-react-native-session-replay by removing compile-time dependencies on non-exposed React-RCTFabric headers (RN 0.87 prebuilt core CocoaPods facades). Also adjusts Android RUM initialization code to avoid kotlin.time usage when converting initialResourceThreshold from seconds to milliseconds.

Changes:

  • iOS: Resolve RCTParagraphComponentView and its props/text access dynamically (runtime lookup + KVC/IMP) to avoid importing React-RCTFabric internal headers under RN 0.87.
  • iOS: Guard RCTConversions.h import behind RCT_VERSION_MINOR <= 73 to match the only branch that needs it.
  • Android: Replace kotlin.time seconds-to-millis conversion with a manual conversion and add a local constant.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react-native-session-replay/ios/Sources/RCTFabricWrapper.mm Removes hard header dependency on RCTParagraphComponentView by dynamically resolving the class and props/text access for RN 0.87 CocoaPods facades.
packages/core/android/src/main/kotlin/com/datadog/reactnative/DdSdkNativeInitialization.kt Reworks initialResourceThreshold seconds→milliseconds conversion without kotlin.time, adds a milliseconds-per-second constant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@marco-saia-datadog
marco-saia-datadog force-pushed the marcosaia/rums-18012/rn-87-support branch from e44f3e8 to 6127279 Compare August 12, 2026 09:35
Copilot AI review requested due to automatic review settings August 12, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

packages/react-native-session-replay/ios/Sources/RCTFabricWrapper.mm:33

  • NSClassFromString(@"RCTParagraphComponentView") is executed on every call; this method is likely invoked frequently during snapshotting, so repeated class lookups add avoidable overhead. Cache the resolved class with dispatch_once and reuse it.
    Class paragraphComponentViewClass = NSClassFromString(@"RCTParagraphComponentView");
    if (paragraphComponentViewClass == nil || ![view isKindOfClass:paragraphComponentViewClass]) {
        return nil;

Comment thread packages/react-native-session-replay/ios/Sources/RCTFabricWrapper.mm Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 12, 2026 09:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/react-native-session-replay/ios/Sources/RCTFabricWrapper.mm:38

  • This change introduces runtime-only behavior (resolving RCTParagraphComponentView/props dynamically and reading attributedText via KVC) but there are no iOS unit tests exercising RCTFabricWrapper’s new-arch extraction path. Without a test, regressions (e.g., selector name changes, unexpected return types, missing KVC compliance) would only be caught at runtime.

Consider adding an XCTest that defines a lightweight fake RCTParagraphComponentView class at runtime (via objc_allocateClassPair) that implements -props and attributedText, then asserts tryToExtractTextPropertiesFromView: returns the expected wrapper for that view and nil for non-matching views.

    Class paragraphComponentViewClass = NSClassFromString(@"RCTParagraphComponentView");
    if (paragraphComponentViewClass == nil || ![view isKindOfClass:paragraphComponentViewClass]) {
        return nil;
    }

    // `-props` is declared on RCTComponentViewProtocol (not on RCTParagraphComponentView
    // itself) and returns a C++ shared_ptr, so it can't be reached through KVC — look it up
    // and call it directly via its IMP instead of importing the protocol's header.
    SEL propsSelector = NSSelectorFromString(@"props");

Copilot AI review requested due to automatic review settings August 12, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@marco-saia-datadog

Copy link
Copy Markdown
Member Author

Closed in favour of #1368

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