Skip to content

have RCTInstance decorate non-app provided turbomodules with bridgeless APIs#48053

Closed
philIip wants to merge 1 commit into
facebook:mainfrom
philIip:export-D66675034
Closed

have RCTInstance decorate non-app provided turbomodules with bridgeless APIs#48053
philIip wants to merge 1 commit into
facebook:mainfrom
philIip:export-D66675034

Conversation

@philIip
Copy link
Copy Markdown
Contributor

@philIip philIip commented Dec 2, 2024

Summary:
Changelog: [Internal]

getModuleInstanceFromClass: is a delegate method intended to be implemented by the product layer to provide modules. if it is not implemented to return a module for a given key, RCTTurboModuleManager will simply call new on the TM class.

however, these two paths differentiate - for getModuleInstanceFromClass:, we will call _attachBridgelessAPIsToModule: which provides objects like surfacePresenter to the native module.

if we fallback to calling new, then this attachment does not happen, even if the app has already been migrated to bridgeless modules.

thus, the fix in the case is to lift the fallback into RCTInstance as well, and decorate the APIs onto the new fallback.

Differential Revision: D66675034

…ss APIs

Summary:
Changelog: [Internal]

`getModuleInstanceFromClass:` is a delegate method intended to be implemented by the product layer to provide modules. if it is not implemented to return a module for a given key, `RCTTurboModuleManager` will simply call `new` on the TM class.

however, these two paths differentiate - for `getModuleInstanceFromClass:`, we will call `_attachBridgelessAPIsToModule:` which provides objects like surfacePresenter to the native module.

if we fallback to calling `new`, then this attachment does not happen, even if the app has already been migrated to bridgeless modules.

thus, the fix in the case is to lift the fallback into RCTInstance as well, and decorate the APIs onto the new fallback.

Differential Revision: D66675034
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Dec 2, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D66675034

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in 0217d7e.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @philIip in 0217d7e

When will my fix make it into a release? | How to file a pick request?

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. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants