Files
react-native/React/Base/RCTJSInvokerModule.h
T
Peter Argany c494d590fb Workarounds for two bridge methods: dispatchToJSThread and enqueueJSCall:
Summary:
To get `RCTNativeAnimatedModule` working bridgeless, I need to get `RCTEventDispatcher` working bridgeless.

To get `RCTEventDispatcher` working bridgeless, I need to support 2 new bridge methods:
- `- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args`
- `- (void)dispatchBlock:(dispatch_block_t)block queue:(dispatch_queue_t)queue;`

For (1) I copied the bridge impl exactly. For (2), the bridge only dispatches to JS thread, else uses `dispatch_async`. I only added support for dispatching to JS thread, callers can `dispatch_async` themselves if they want to.

Changelog: [Internal]

Differential Revision: D22962292

fbshipit-source-id: e34d15aee72f80dffcaa945bfda05ea415f66df7
2020-08-07 11:55:51 -07:00

19 lines
624 B
Objective-C

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* This protocol should be adopted when a turbo module needs to directly call into JavaScript.
* In bridge-less React Native, it is a replacement for [_bridge enqueueJSCall:].
*/
@protocol RCTJSInvokerModule
@optional
@property (nonatomic, copy) void (^invokeJS)(NSString *module, NSString *method, NSArray *args);
@property (nonatomic, copy) void (^invokeJSWithModuleDotMethod)(NSString *moduleDotMethod, NSArray *args);
@end