Skip to content

fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS#4047

Open
DavidDuarte22 wants to merge 1 commit intosoftware-mansion:mainfrom
DavidDuarte22:fix/guard-load-with-dynamic-frameworks
Open

fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS#4047
DavidDuarte22 wants to merge 1 commit intosoftware-mansion:mainfrom
DavidDuarte22:fix/guard-load-with-dynamic-frameworks

Conversation

@DavidDuarte22
Copy link
Copy Markdown

Summary

The +load method in RNGestureHandlerButtonComponentView is unconditional, but its parent RCTViewComponentView correctly guards its +load behind #ifdef RCT_DYNAMIC_FRAMEWORKS.

Without the guard, the child's +load runs even when dynamic frameworks are not used, causing conflicts with third-party SDKs (e.g. Akamai BMP) that also use +load — particularly on x86_64 simulators where the load order differs from arm64.

This matches the pattern used by React Native core in RCTViewComponentView.mm (see facebook/react-native#37274).

Test plan

  • Build xcframework with static linking (no USE_FRAMEWORKS=dynamic)
  • Verify RNGestureHandlerButtonComponentView +load is not in the binary (nm check)
  • Run on x86_64 simulator alongside Akamai BMP — no crash at launch
  • Run on arm64 simulator — gesture handler works normally

The +load method in RNGestureHandlerButtonComponentView is unconditional,
but its parent RCTViewComponentView correctly guards its +load behind
#ifdef RCT_DYNAMIC_FRAMEWORKS. Without the guard, the child's +load
runs even when dynamic frameworks are not used, causing conflicts with
third-party SDKs (e.g. Akamai BMP) that also use +load — particularly
on x86_64 simulators where the load order differs from arm64.

This matches the pattern used by React Native core in
RCTViewComponentView.mm (see facebook/react-native#37274).
Copilot AI review requested due to automatic review settings March 31, 2026 12:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a guard to conditionally compile the +load method in RNGestureHandlerButtonComponentView only when dynamic frameworks are enabled, preventing +load execution conflicts with third-party SDKs when using static frameworks. This addresses a critical issue where the child class's +load method runs unconditionally, while its parent class RCTViewComponentView guards its own +load method, leading to load order conflicts particularly on x86_64 simulators.

Changes:

  • Added #ifdef RCT_DYNAMIC_FRAMEWORKS guard before the +load method
  • Added corresponding #endif after the +load method implementation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@m-bert m-bert left a comment

Choose a reason for hiding this comment

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

Thank you!

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.

3 participants