chore: TurboModule method signature mismatch in Swift by removing external parameter label #352
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.
Overview
This PR fixes an issue while building RN app based on 0.76.
Problem
When calling the
trackNotificationResponseReceived
method via TurboModule for React Native, a compilation failure occurred at the parameter mapping stage between JavaScript and Swift/Objective-C. Debug logs revealed that thetrackNotificationResponseReceived:(NSDictionary *)payload
method was not recognized correctly because the arguments array was passed as null.Solution
To remove this inconsistency, we added
_
(an unnamed label) to Swift class for the payload parameter in thetrackNotificationResponseReceived
andtrackNotificationReceived
methods. This made both methods more compatible with Objective-C because_
removes the need to specify the parameter name when calling it, thus eliminating signature differences and allowing TurboModule to recognize the method correctly.Logs
I've also added some logs to identify the problematic methods:
RCTInteropTurboModule.parseExportedMethods:
Other methods:
Broken one: