Skip to content

Commit

Permalink
Add completion block when call js module function (#47998)
Browse files Browse the repository at this point in the history
Summary:
Fabric bridgeless don't call completion block when call js module method, so let's support it :).

## Changelog:

[IOS] [FIXED] - [Fabric] Add completion block when call js module function

Pull Request resolved: #47998

Test Plan: Module call js module method when passed `onComplete` block can be called successfully in bridgeless mode.

Reviewed By: fabriziocucci

Differential Revision: D66594514

Pulled By: javache

fbshipit-source-id: 74644b1f359a24cfa93389451e172fbc6a8ee1a1
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Nov 29, 2024
1 parent 5ff59b4 commit 91e217f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ - (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
[_bridgeModuleDecorator.callableJSModules
setBridgelessJSModuleMethodInvoker:^(
NSString *moduleName, NSString *methodName, NSArray *args, dispatch_block_t onComplete) {
// TODO: Make RCTInstance call onComplete
[weakSelf callFunctionOnJSModule:moduleName method:methodName args:args];
if (onComplete) {
[weakSelf
callFunctionOnBufferedRuntimeExecutor:[onComplete](facebook::jsi::Runtime &_) { onComplete(); }];
}
}];
}
_launchOptions = launchOptions;
Expand Down

0 comments on commit 91e217f

Please sign in to comment.