Skip to content

Commit

Permalink
Make RCTTurboModule getTurboModule: required
Browse files Browse the repository at this point in the history
Summary:
## Rationale
There are two ways to associate NativeModule ObjC objects with ObjCTurboModule jsi::HostObjects:
1. Via the NativeModule ObjC class's `getTurboModule:` method.
2. Via the TurboModule manager delegate's getTurboModule:initParams: method.

There's no good reason to support both options. So, this diff stack removes 2, and make 1 mandatory for all RCTTurboModules. Not only will this simplify the infra, but it should also help eliminate a class of runtime errors in the TurboModule standalone app migration: you forget to implement the getTurboModule: method.

Changelog: [iOS][Changed] - Make RCTTurboModule getTurboModule: required

Reviewed By: PeteTheHeat

Differential Revision: D27316129

fbshipit-source-id: baccd155b8c191d0f961b316db552bdfdbeb0a97
  • Loading branch information
RSNara authored and facebook-github-bot committed Apr 9, 2021
1 parent 3f38186 commit e0b8f50
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class JSI_EXPORT ObjCTurboModule : public TurboModule {
*/
@property (nonatomic, weak) id<RCTTurboModuleRegistry> turboModuleRegistry;

@required
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params;

Expand Down

0 comments on commit e0b8f50

Please sign in to comment.