fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS#4047
Open
DavidDuarte22 wants to merge 1 commit intosoftware-mansion:mainfrom
Open
fix(ios): guard +load with #ifdef RCT_DYNAMIC_FRAMEWORKS#4047DavidDuarte22 wants to merge 1 commit intosoftware-mansion:mainfrom
DavidDuarte22 wants to merge 1 commit intosoftware-mansion:mainfrom
Conversation
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).
Contributor
There was a problem hiding this comment.
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_FRAMEWORKSguard before the+loadmethod - Added corresponding
#endifafter the+loadmethod implementation
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
+loadmethod inRNGestureHandlerButtonComponentViewis unconditional, but its parentRCTViewComponentViewcorrectly guards its+loadbehind#ifdef RCT_DYNAMIC_FRAMEWORKS.Without the guard, the child's
+loadruns 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
USE_FRAMEWORKS=dynamic)RNGestureHandlerButtonComponentView +loadis not in the binary (nmcheck)