mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
f0d0c1c688
Summary: Problem: Certain turbo modules use the bridge to access JS directly by calling something like `[_bridge enqueueJSCall:]`. In a bridgeless world, this API no longer works. Solution: These turbo modules can implement the new protocol defined here. This protocol provides a block during module init which can be used to call JS directly (using `ReactContext`) instead of going through the bridge. Changelog: [Internal][iOS] - Introducing RCTJSInvokerModule, a new protocol for turbo modules which call js Reviewed By: RSNara Differential Revision: D18941933 fbshipit-source-id: 8d581df06be59debf83575124e7d221145c5afb8
17 lines
513 B
Objective-C
17 lines
513 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
|
|
|
|
@property (nonatomic, copy, nonnull) void (^invokeJS)(NSString *module, NSString *method, NSArray *args);
|
|
|
|
@end
|