Skip to content

Conversation

@tjzel
Copy link
Contributor

@tjzel tjzel commented Aug 13, 2025

Summary:

Currently it's impossible to discover TurboModules that implement a given interface. This is handy when we need to initialize modules based on the fact if they implement a given interface or not. Currently it's impossible to do so without initializing the modules that don't implement the given interface too.

This pull request implements this functionality on Android. Implementation for iOS is in another pull request:

I implemented it by adding an overload for ReactModuleInfo class that takes the Class of the TurboModule as a parameter. Unfortunately I can't obtain the class via it's name, because the docs are suggesting to replace the name of the (java) Class with a custom name:

Screenshot 2025-08-14 at 20 02 33

Changelog:

[Android] [ADDED] - Allow to get from TurboModuleManager TurboModules that implement a given interface at any point in time.

Test Plan:

Example use to get all modules implementing LifecycleEventListener class.

Screenshot 2025-08-14 at 19 51 45

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 13, 2025
@facebook-github-bot facebook-github-bot added p: Software Mansion Partner: Software Mansion Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Aug 13, 2025
@tjzel tjzel changed the title feat: discover TurboModules conforming to interface/selector feat(Android): discover TurboModules conforming to interface/selector Aug 14, 2025
@tjzel tjzel changed the title feat(Android): discover TurboModules conforming to interface/selector feat(Android): get TurboModules implementing given interface Aug 14, 2025
@tjzel tjzel marked this pull request as draft August 14, 2025 15:28
@tjzel
Copy link
Contributor Author

tjzel commented Sep 25, 2025

Closing in favor of #53928

@tjzel tjzel closed this Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Software Mansion Partner: Software Mansion Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants