mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
5127ac5c2a
Summary: ## Background Legacy Cxx NativeModules are implemented as Hybrid classes. Essentially, when a Cxx NativeModule is requested, you instantiate its hybrid class, which then creates a C++ counterpart. Then, the bridge uses the C++ counterpart's `getModule()` method to obtain ownership of the Cxx NativeModule. ## Summary This diff implements backwards-compability for Cxx NativeModules. If a Cxx NativeModule implements the `TurboModule` interface, then when the module is requested by name, we: 1. Instantiate its Java hybrid class, createing a C++ counterpart. 3. Obtain the CxxModule from the C++ counterpart using `getModule()` and use it to create a `TurboCxxModule` instance (this forwards all JavaScript method calls to the CxxModule) inside `TurboModuleManager`. 5. Return this `TurboCxxModule` to JS. Reviewed By: mdvacca Differential Revision: D15252041 fbshipit-source-id: cdbb62632d7a8735f7687daf62de63df9e3ad2c5