Skip to content

Commit

Permalink
fix(ios): resolve compatibility issue when using ResponseSenderBlock
Browse files Browse the repository at this point in the history
The problem occurs only in UI components,
Methods in modules are not affected.
  • Loading branch information
wwwcg committed Sep 18, 2024
1 parent 13163c6 commit 30252f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion framework/ios/base/modules/HippyModuleMethod.mm
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,11 @@ - (void)processMethodSignature {
// so it is not a Number anymore.
// See NativeRenderManager::CallFunction() for more.
// TODO: add more type check for safe
blockArg = json;
blockArg = ^(NSArray *args){
// Since the block passed from UIManager's dispatchFunction method is of type HippyPromiseResolve,
// a small conversion is required here to avoid compatibility issues.
((HippyPromiseResolveBlock)json)(args.count > 0 ? args.firstObject : NSNull.null);
};
} else {
__weak HippyBridge *weakBridge = bridge;
blockArg = ^(NSArray *args){
Expand Down

0 comments on commit 30252f8

Please sign in to comment.