SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Codemod: Give legacy cxx and ObjC-only NativeModules a getTurboModule: method

Summary:
We're making the getTurboModule: method required for all classes that conform to RCTTurboModule.

Many of our ObjC-only and Cxx NativeModules don't implement this method. This diff implements a getTurboModule: method on all those modules that returns nullptr.

**Question:** Why is it fine to make ObjC-only NativeModules return nullptr from their getTurboModule: method?
- Because they're only accessed from ObjC, and should appear as null on the JavaScript side. Longer term, these NativeModules will also go away.

**Question:** Why is it fine to make Cxx NativeModules return nullptr from getTurboModule: method?
- Because after D27316872, the TurboModuleManager checks if the module is a CxxModule first. If it is, we do an early return, and never call the module's getTurboModule: method.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D27316871

fbshipit-source-id: bc693f2927ab3b0de24e6e9e7699390ec0f7d729
R
Ramanpreet Nara committed
3f38186b780d9593d67a20e0cfafb76c15df78cc
Parent: 6a5e98a
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> on 4/9/2021, 4:15:52 AM