Skip to content

Make native module resolution lazy and expose core internals entry point#1316

Draft
cdn34dd wants to merge 3 commits into
developfrom
carlosnogueira/draft/lazy-native-module-resolution
Draft

Make native module resolution lazy and expose core internals entry point#1316
cdn34dd wants to merge 3 commits into
developfrom
carlosnogueira/draft/lazy-native-module-resolution

Conversation

@cdn34dd

@cdn34dd cdn34dd commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR makes Datadog React Native native module specs resolve lazily instead of at module importtime. It updates the core SDK wrappers to use explicit native module getter functions, adds regression tests to verify imports no longer trigger TurboModuleRegistry lookups, and exposes a scoped @datadog/mobile-react-native/internal entry point for platform packages that need shared core internals.

Motivation

Some platforms, such as Vega, need to import parts of the core package in environments where the React Native native modules are not available. Resolving TurboModules during import makes those imports fail before the caller actually uses native functionality.

Lazy native module resolution keeps the package import-safe while preserving runtime behavior on supported React Native platforms. The internal entry point also avoids unsupported deep imports from platform packages by providing a single maintained path for shared core internals.

Additional Notes

Anything else we should know when reviewing?

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

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jun 28, 2026

Copy link
Copy Markdown

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/dd-sdk-reactnative | test:lint   View in Datadog   GitLab

DataDog/dd-sdk-reactnative | test:native-android   View in Datadog   GitLab

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5db666e | Docs | Datadog PR Page | Give us feedback!

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.

1 participant