Files
react-native/React/Base/RCTJSInvokerModule.h
T
Peter Argany f0d0c1c688 Introducing RCTJSInvokerModule [1/N]
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
2019-12-23 13:52:03 -08:00

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