Skip to content

fix: compatibility to rn + 0.79#186

Merged
uc-brunosouza merged 2 commits intomasterfrom
MSDK-3294/fix-unable-to-find-module-dependency-react-codegen
Feb 26, 2026
Merged

fix: compatibility to rn + 0.79#186
uc-brunosouza merged 2 commits intomasterfrom
MSDK-3294/fix-unable-to-find-module-dependency-react-codegen

Conversation

@uc-brunosouza
Copy link
Collaborator

@uc-brunosouza uc-brunosouza commented Feb 25, 2026

User description

Summary by CodeRabbit

  • New Features

    • Added iOS New Architecture support with TurboModule bridging and compatibility across React Native 0.77, 0.78, and 0.79+.
  • Chores

    • Updated packaging configuration to support codegen/TurboModule dependencies and improve compatibility with Expo prebuild and the new RN architecture.

CodeAnt-AI Description

Fix iOS build and TurboModule registration across React Native 0.77–0.79+

What Changed

  • iOS Swift module now imports the correct codegen headers depending on RN version so builds no longer fail with missing-module errors on RN 0.78 and RN 0.79+
  • Added an Objective-C++ TurboModule shim that implements TurboModule registration for RN 0.78+ so the native module loads under React Native's New Architecture
  • Podspec now injects codegen dependencies when available and preserves C++ build flags and header search paths so the library builds in Expo prebuild and new-architecture projects

Impact

✅ Builds on RN 0.79+
✅ Fewer iOS build failures during prebuild
✅ Native module registers with New Architecture (TurboModule)

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@uc-brunosouza uc-brunosouza self-assigned this Feb 25, 2026
@qodo-code-review
Copy link

Review Summary by Qodo

Fix React Native 0.79 compatibility with ReactCodegen support

🐞 Bug fix ✨ Enhancement

Grey Divider

Walkthroughs

Description
• Support React Native 0.79+ with ReactCodegen module import
• Add Objective-C++ TurboModule implementation for new architecture
• Update podspec with install_modules_dependencies for codegen
• Maintain backward compatibility with RN 0.77 and 0.78
Diagram
flowchart LR
  RN["React Native versions"]
  RN -->|"RN ≥ 0.79"| ReactCodegen["ReactCodegen module"]
  RN -->|"RN 0.78"| React_Codegen["React_Codegen module"]
  RN -->|"RN ≤ 0.77"| RNUsercentricsModuleSpec["RNUsercentricsModuleSpec"]
  ReactCodegen --> TurboModuleMM["TurboModule.mm C++ impl"]
  React_Codegen --> NativeUsercentricsModuleSpec["NativeUsercentricsModuleSpec protocol"]
  RNUsercentricsModuleSpec --> NativeUsercentricsSpec["NativeUsercentricsSpec protocol"]
  TurboModuleMM --> getTurboModule["getTurboModule implementation"]
  NativeUsercentricsModuleSpec --> getTurboModule
  NativeUsercentricsSpec --> getTurboModule
Loading

Grey Divider

File Changes

1. ios/RNUsercentricsModule.swift 🐞 Bug fix +17/-7

Version-specific protocol conformance and imports

• Reordered conditional imports to prioritize ReactCodegen for RN 0.79+
• Added React_Codegen import for RN 0.78 compatibility
• Implemented version-specific protocol conformance (NativeUsercentricsModuleSpec for 0.78,
 NativeUsercentricsSpec for ≤0.77)
• Simplified RCTBridgeModule extension syntax

ios/RNUsercentricsModule.swift


2. react-native-usercentrics.podspec ⚙️ Configuration changes +6/-12

Podspec codegen dependencies and header paths

• Added install_modules_dependencies call to inject codegen dependencies
• Removed hardcoded React-Codegen and React-Fabric header search paths
• Removed Portuguese comment and simplified C++ configuration comments
• Improved compatibility with Expo prebuild and New Architecture

react-native-usercentrics.podspec


3. ios/RNUsercentricsModule+TurboModule.mm ✨ Enhancement +34/-0

New TurboModule C++ implementation file

• New Objective-C++ file implementing getTurboModule for RN 0.79+ New Architecture
• Provides C++ return type (shared_ptr<TurboModule>) required by RCTTurboModule protocol
• Includes conditional header imports for ReactCodegen with fallback paths
• Wraps implementation in RCT_NEW_ARCH_ENABLED preprocessor guard

ios/RNUsercentricsModule+TurboModule.mm


Grey Divider

Qodo Logo

@qodo-code-review
Copy link

qodo-code-review bot commented Feb 25, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Fragile codegen header include 🐞 Bug ⛯ Reliability
Description
The TurboModule ObjC++ file imports a codegen-generated header via either `` or a quoted include
("RNUsercentricsModule/..."). The podspec no longer adds explicit React-Codegen/ReactCodegen
header search paths and only injects codegen dependencies when install_modules_dependencies is
defined, so some new-arch builds can fail with missing-header errors.
Code

ios/RNUsercentricsModule+TurboModule.mm[R13-18]

+// Header generated by the app's codegen (ReactCodegen pod; path may vary by RN version)
+#if __has_include(<ReactCodegen/RNUsercentricsModule/RNUsercentricsModule.h>)
+#import <ReactCodegen/RNUsercentricsModule/RNUsercentricsModule.h>
+#else
+#import "RNUsercentricsModule/RNUsercentricsModule.h"
+#endif
Evidence
The ObjC++ file requires the generated header to compile under RCT_NEW_ARCH_ENABLED. The podspec
now relies on a conditional helper to add these dependencies and does not provide explicit header
search paths that would make the fallback quoted include resolvable.

ios/RNUsercentricsModule+TurboModule.mm[13-18]
react-native-usercentrics.podspec[23-26]
react-native-usercentrics.podspec[43-55]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`RNUsercentricsModule+TurboModule.mm` requires a codegen header but the podspec no longer guarantees header search paths/dependencies unless `install_modules_dependencies` is defined and effective. This can lead to `file not found` build errors for new-arch consumers.
### Issue Context
Header locations differ across RN versions (`ReactCodegen` vs `React-Codegen`), and consumers may not always have the helper available (custom Podfiles/build setups).
### Fix Focus Areas
- ios/RNUsercentricsModule+TurboModule.mm[13-18]
- react-native-usercentrics.podspec[23-55]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. ReactCodegen conformance missing 🐞 Bug ⛯ Reliability
Description
On the RN ≥ 0.79 path (when canImport(ReactCodegen) is true), Swift does not declare any
generated-spec/TurboModule conformance, relying solely on the ObjC++ getTurboModule: category. If
the RN runtime/registration checks protocol conformance (vs. method presence),
TurboModuleRegistry.get('RNUsercentricsModule') can fail, making the JS module unavailable in
new-arch/bridgeless setups.
Code

ios/RNUsercentricsModule.swift[R231-248]

// MARK: - RCTBridgeModule & TurboModule Conformance
#if RCT_NEW_ARCH_ENABLED
+#if canImport(React_Codegen)
+// RN 0.78: codegen-generated protocol
+extension RNUsercentricsModule: NativeUsercentricsModuleSpec {
+    func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
+        return self
+    }
+}
+#elseif canImport(RNUsercentricsModuleSpec)
+// RN ≤ 0.77
extension RNUsercentricsModule: NativeUsercentricsSpec {
  func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
      return self
  }
}
+#endif
Evidence
Swift explicitly treats RN ≥ 0.79 as a special path but provides no conformance in that case, while
JS expects a TurboModule to exist (and throws if neither TurboModule nor legacy module is
available). The ObjC++ category adds getTurboModule: but does not declare adoption of
RCTTurboModule / generated spec protocol, leaving registration behavior dependent on RN internals.

ios/RNUsercentricsModule.swift[7-16]
ios/RNUsercentricsModule.swift[232-248]
ios/RNUsercentricsModule+TurboModule.mm[20-32]
src/NativeUsercentrics.ts[64-74]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
For RN ≥ 0.79, the Swift module intentionally avoids importing `ReactCodegen`, but currently also provides no spec/TurboModule protocol conformance in that path. The ObjC++ category implements `getTurboModule:`, but it does not declare protocol adoption either. Depending on RN’s registration expectations, this can prevent TurboModule registration.
### Issue Context
Swift cannot reliably import C++-heavy modules; protocol adoption can be done in ObjC/ObjC++ categories to avoid Swift imports.
### Fix Focus Areas
- ios/RNUsercentricsModule+TurboModule.mm[11-33]
- ios/RNUsercentricsModule.swift[232-248]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Missing memory header 🐞 Bug ✓ Correctness
Description
The new ObjC++ TurboModule file uses std::shared_ptr/std::make_shared without explicitly
including ``, which can fail compilation depending on transitive includes and build settings.
Code

ios/RNUsercentricsModule+TurboModule.mm[R27-30]

+- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
+    (const facebook::react::ObjCTurboModule::InitParams &)params {
+  return std::make_shared<facebook::react::NativeUsercentricsModuleSpecJSI>(params);
+}
Evidence
The file directly uses std::shared_ptr and std::make_shared but has no explicit C++ standard
library include for them.

ios/RNUsercentricsModule+TurboModule.mm[7-12]
ios/RNUsercentricsModule+TurboModule.mm[27-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`std::shared_ptr` / `std::make_shared` require `&amp;amp;lt;memory&amp;amp;gt;`, but the file does not include it explicitly.
### Issue Context
Relying on transitive includes is fragile and can break with header reordering or RN header changes.
### Fix Focus Areas
- ios/RNUsercentricsModule+TurboModule.mm[7-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coderabbitai
Copy link

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Adds iOS TurboModule bridging for React Native New Architecture: an Objective-C++ thin wrapper exposing a C++ TurboModule, Swift conformance branches for multiple RN versions, and podspec updates to support conditional codegen dependencies and simplified header/search paths.

Changes

Cohort / File(s) Summary
TurboModule ObjC++ bridge
ios/RNUsercentricsModule+TurboModule.mm
Adds an ObjC++ category exposing - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams&)params; gated by RCT_NEW_ARCH_ENABLED, returning a C++ TurboModule wrapper.
Swift TurboModule conformance
ios/RNUsercentricsModule.swift
Adds conditional canImport branches for RN ≥0.79 / 0.78 / ≤0.77 to conform to the appropriate generated module spec and implement getTurboModule(jsInvoker:) -> Any. Also compacts RCTBridgeModule extension formatting.
Build / podspec
react-native-usercentrics.podspec
Updates C++ configuration to conditionally call install_modules_dependencies when available, adjusts preprocessor/C++ flags, and simplifies header_search_paths (removes explicit Fabric/Codegen header additions).

Sequence Diagram(s)

sequenceDiagram
    participant JS as JavaScript
    participant RN as RN TurboModule System
    participant ObjCxx as ObjC++ Bridge
    participant Swift as RNUsercentricsModule (Swift)

    JS->>RN: call native method on TurboModule
    RN->>ObjCxx: resolve TurboModule via getTurboModule(params)
    ObjCxx->>Swift: forward invoker / provide module instance
    Swift-->>RN: return module implementation (as Any / JS-facing object)
    RN-->>JS: deliver result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Review effort 2/5

Suggested reviewers

  • souzabrunoj

Poem

🐰 I hopped through ObjC++ and Swift so spry,
Bridged TurboModules beneath the sky.
Three branches met, versions in tune,
A tiny bridge beneath the moon. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly relates to the main objective: fixing iOS React Native compatibility for RN 0.78+ and RN 0.79. It accurately captures the primary change addressing version compatibility issues.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch MSDK-3294/fix-unable-to-find-module-dependency-react-codegen

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codeant-ai codeant-ai bot added the size:M This PR changes 30-99 lines, ignoring generated files label Feb 25, 2026
@pantoaibot
Copy link

pantoaibot bot commented Feb 25, 2026

PR Summary:

Upgrade iOS native module to support RN new-architecture naming changes (RN 0.78/0.79) and ensure TurboModule codegen/C++ build flags work with Expo/prebuild.

  • Added ios/RNUsercentricsModule+TurboModule.mm

    • Implements getTurboModule as an ObjC++ category (returns shared_ptr) to satisfy RCTTurboModule protocol for new architecture (guarded by RCT_NEW_ARCH_ENABLED).
    • Keeps C++/TurboModule implementation out of Swift to avoid C++ import issues.
  • Modified ios/RNUsercentricsModule.swift

    • Improved conditional imports to support different codegen module names:
      • ReactCodegen (RN ≥ 0.79)
      • React_Codegen (RN 0.78)
      • RNUsercentricsModuleSpec (RN ≤ 0.77)
    • Added conditional TurboModule protocol extensions matching each codegen variant so the Swift class conforms correctly under the new architecture.
    • Minor style/simplification for RCTBridgeModule fallback.
  • Modified react-native-usercentrics.podspec

    • Injects codegen dependencies for TurboModules when available (calls install_modules_dependencies(s)) so ReactCodegen/React_Codegen are pulled in for RN 0.78+.
    • Consolidates C++/compiler flags (c++20, libc++) and header search paths (React-Core, ReactCommon, React-NativeModulesApple, etc.) to ensure New Architecture and Expo prebuild compatibility.

Notes/impact:

  • No runtime API changes; changes are build-time compatibility fixes for RN 0.78/0.79 (New Architecture / TurboModule codegen naming).
  • New code is gated by RCT_NEW_ARCH_ENABLED where applicable.

Reviewed by Panto AI

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

Nitpicks 🔍

🔒 No security issues identified
⚡ Recommended areas for review

  • Header search paths
    The podspec relies on install_modules_dependencies to inject codegen-related dependencies, but there's no fallback path added for React-Codegen / React-Fabric headers. Some consumers (or older tooling) may not have that helper defined, which can cause missing header errors when building the New Architecture.

  • TurboModule binding check
    The ObjC++ file returns a NativeUsercentricsModuleSpecJSI JSI TurboModule wrapper. Verify the generated class name and the Swift protocol names match across RN versions (NativeUsercentricsModuleSpec / NativeUsercentricsSpec / NativeUsercentricsModuleSpecJSI). Mismatches between generated names across RN versions cause runtime lookup failures.

  • Wrong error code
    The reject call in showSecondLayer uses the error identifier for showFirstLayer. This looks like a copy-paste bug and will make it harder to identify / handle second-layer failures from JS.

Comment on lines +234 to 246
#if canImport(React_Codegen)
// RN 0.78: codegen-generated protocol
extension RNUsercentricsModule: NativeUsercentricsModuleSpec {
func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
return self
}
}
#elseif canImport(RNUsercentricsModuleSpec)
// RN ≤ 0.77
extension RNUsercentricsModule: NativeUsercentricsSpec {
func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
return self
}
Copy link

Choose a reason for hiding this comment

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

[CRITICAL_BUG] The extension implements/declares conformance to NativeUsercentricsModuleSpec which does not match the generated protocol name in the project reference (NativeUsercentricsSpec). This will cause a compile-time error (type not found). Replace NativeUsercentricsModuleSpec with the correct generated protocol (NativeUsercentricsSpec) or detect the correct symbol via canImport and adapt accordingly. Also run a clean build to verify the generated module/protocol name for the targeted RN versions.

#if RCT_NEW_ARCH_ENABLED
#if canImport(React_Codegen)
// RN 0.78: codegen-generated protocol
extension RNUsercentricsModule: NativeUsercentricsSpec {
    func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
        return self
    }
}
#elseif canImport(RNUsercentricsModuleSpec)
// RN ≤ 0.77
extension RNUsercentricsModule: NativeUsercentricsSpec {
    func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
        return self
    }
}
#endif
#else
extension RNUsercentricsModule: RCTBridgeModule {}
#endif

Comment on lines +8 to +13
#if canImport(ReactCodegen)
// RN ≥ 0.79: getTurboModule: implemented in RNUsercentricsModule+TurboModule.mm (do not import ReactCodegen in Swift — C++ module)
#elseif canImport(React_Codegen)
// RN 0.78
import React_Codegen
#elseif canImport(RNUsercentricsModuleSpec)
Copy link

Choose a reason for hiding this comment

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

[REFACTORING] The preprocessor branch uses canImport(ReactCodegen) (no underscore) followed by canImport(React_Codegen). The module name historically used by RN codegen is 'React_Codegen' (with underscore). The top-level canImport(ReactCodegen) branch is ambiguous and only contains a comment (no import). Consider removing the canImport(ReactCodegen) check (or correct it) and consolidate logic so it's explicit which RN versions import which module. This avoids confusion and accidental dead branches during compilation.

#if RCT_NEW_ARCH_ENABLED
// RN ≥ 0.79: getTurboModule: implemented in RNUsercentricsModule+TurboModule.mm (do not import ReactCodegen in Swift — C++ module)
#if canImport(React_Codegen)
// RN 0.78
import React_Codegen
#elif canImport(RNUsercentricsModuleSpec)
// RN ≤ 0.77
import RNUsercentricsModuleSpec
#endif
#endif

Comment on lines +27 to +30
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params {
return std::make_shared<facebook::react::NativeUsercentricsModuleSpecJSI>(params);
}
Copy link

Choose a reason for hiding this comment

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

[CRITICAL_BUG] The code returns std::make_sharedfacebook::react::NativeUsercentricsModuleSpecJSI(params). That generated C++/JSI type may not exist (name varies by RN/codegen). This will fail linking/compilation if the generated JSI class name or header differs. Actionable options: 1) Verify the exact generated C++ type name and include the correct generated header from codegen, or 2) if relying on an ObjC TurboModule wrapper, return an ObjCTurboModule-backed TurboModule (or nullptr) until the generated JSI class is available. At minimum, add a compile-time guard/comment and test building with RN 0.78/0.79 to confirm the correct symbol.

- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
    (const facebook::react::ObjCTurboModule::InitParams &)params {
#if __has_include(<ReactCodegen/RNUsercentricsModule/RNUsercentricsModule.h>)
  return std::make_shared<facebook::react::NativeUsercentricsModuleSpecJSI>(params);
#else
  // Fallback for configurations where the generated JSI type is not available
  return nullptr;
#endif
}

Comment on lines +23 to +26
# Required for TurboModules RN 0.78+: injects codegen dependencies (ReactCodegen, etc.)
if defined?(install_modules_dependencies)
install_modules_dependencies(s)
end
Copy link

Choose a reason for hiding this comment

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

[CRITICAL_BUG] The podspec now calls install_modules_dependencies(s) when defined to inject codegen dependencies, but it no longer provides a fallback header_search_paths addition for environments where install_modules_dependencies isn't defined (older RN versions or custom prebuild flows). This can lead to missing React-Codegen / React-Fabric headers and broken iOS builds. Actionable fix: add a fallback branch that appends the React-Fabric/React-Codegen header paths (the previously removed entries) when install_modules_dependencies is not defined, or explicitly check supported RN versions and document that install_modules_dependencies must exist in the consuming project.

  # Required for TurboModules RN 0.78+: injects codegen dependencies (ReactCodegen, etc.)
  if defined?(install_modules_dependencies)
    install_modules_dependencies(s)
  else
    # Fallback for projects without install_modules_dependencies (older RN / custom setups)
    header_search_paths += [
      '$(PODS_ROOT)/Headers/Public/React-Fabric',
      '$(PODS_ROOT)/Headers/Public/React-Codegen',
      '$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers',
      '$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers'
    ]
  end

  # C++ configuration (compatible with Expo prebuild and New Architecture)
  base_cpp_flags = {
    'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
    'CLANG_CXX_LIBRARY' => 'libc++',
    'OTHER_CPLUSPLUSFLAGS' => '-std=c++20 -stdlib=libc++ $(inherited)',
    'CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER' => 'NO',
    'CLANG_WARN_DOCUMENTATION_COMMENTS' => 'NO',
    'GCC_WARN_INHIBIT_ALL_WARNINGS' => 'YES',
    'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
    'DEFINES_MODULE' => 'YES',
    'USE_HEADERMAP' => 'YES',
    'ALWAYS_SEARCH_USER_PATHS' => 'NO'
  }

  base_cpp_flags['HEADER_SEARCH_PATHS'] = header_search_paths.map { |path| "\"#{path}\"" }.join(' ')

@pantoaibot
Copy link

pantoaibot bot commented Feb 25, 2026

Reviewed up to commit:8a1d201fd92a0f8418655677172b10aa970f3654

Additional Suggestion
ios/RNUsercentricsModule.swift, line:236-239 The getTurboModule(jsInvoker: RCTJSInvoker) -> Any signature is used here for TurboModule conformance. Generated protocol signatures and types (RCTJSInvoker) can vary between RN versions. Verify that RCTJSInvoker is available to Swift under the chosen canImport branches and that the method signature matches the generated protocol for each RN version you intend to support. If the type or signature differs, adapt the declaration to match the generated header or provide conditional compilation that aligns with the correct generated protocol.
#if RCT_NEW_ARCH_ENABLED
#if canImport(React_Codegen)
extension RNUsercentricsModule: NativeUsercentricsSpec {
    func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
        return self
    }
}
#elif canImport(RNUsercentricsModuleSpec)
extension RNUsercentricsModule: NativeUsercentricsSpec {
    func getTurboModule(jsInvoker: RCTJSInvoker) -> Any {
        return self
    }
}
#endif
#else
extension RNUsercentricsModule: RCTBridgeModule {}
#endif

Reviewed by Panto AI

Comment on lines +13 to +18
// Header generated by the app's codegen (ReactCodegen pod; path may vary by RN version)
#if __has_include(<ReactCodegen/RNUsercentricsModule/RNUsercentricsModule.h>)
#import <ReactCodegen/RNUsercentricsModule/RNUsercentricsModule.h>
#else
#import "RNUsercentricsModule/RNUsercentricsModule.h"
#endif

Choose a reason for hiding this comment

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

Action required

1. Fragile codegen header include 🐞 Bug ⛯ Reliability

The TurboModule ObjC++ file imports a codegen-generated header via either <ReactCodegen/...> or a
quoted include ("RNUsercentricsModule/..."). The podspec no longer adds explicit
React-Codegen/ReactCodegen header search paths and only injects codegen dependencies when
install_modules_dependencies is defined, so some new-arch builds can fail with missing-header
errors.
Agent Prompt
### Issue description
`RNUsercentricsModule+TurboModule.mm` requires a codegen header but the podspec no longer guarantees header search paths/dependencies unless `install_modules_dependencies` is defined and effective. This can lead to `file not found` build errors for new-arch consumers.

### Issue Context
Header locations differ across RN versions (`ReactCodegen` vs `React-Codegen`), and consumers may not always have the helper available (custom Podfiles/build setups).

### Fix Focus Areas
- ios/RNUsercentricsModule+TurboModule.mm[13-18]
- react-native-usercentrics.podspec[23-55]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

@codeant-ai
Copy link

codeant-ai bot commented Feb 25, 2026

CodeAnt AI finished reviewing your PR.

@codeant-ai
Copy link

codeant-ai bot commented Feb 26, 2026

CodeAnt AI is running Incremental review


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai bot added size:M This PR changes 30-99 lines, ignoring generated files and removed size:M This PR changes 30-99 lines, ignoring generated files labels Feb 26, 2026
@codeant-ai
Copy link

codeant-ai bot commented Feb 26, 2026

CodeAnt AI Incremental review completed.

@uc-brunosouza uc-brunosouza merged commit fe03af4 into master Feb 26, 2026
4 checks passed
@uc-brunosouza uc-brunosouza deleted the MSDK-3294/fix-unable-to-find-module-dependency-react-codegen branch February 26, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants