Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the interop-layer work with components with custom name #41376

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

fortmarek
Copy link
Contributor

Summary:

Cherry-pick of daedbe6.

Created a PR as the commit caused merge conflicts in the 0.72-stable branch.

Changelog:

[iOS][Fixed] - Add support for Components with custom names in the interop layer.

Test Plan:

See: #41207

@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: Shopify Partner: Shopify Partner labels Nov 8, 2023
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly good, there are two chunks of code that must be removed.

Comment on lines 106 to 110
RCTBridgeProxy *bridgeProxy;
auto optionalBridgeProxy = contextContainer->find<std::shared_ptr<void>>("RCTBridgeProxy");
if (optionalBridgeProxy) {
bridgeProxy = unwrapManagedObjectWeakly(optionalBridgeProxy.value());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be removed. 0.72 does not have bridgeless and thus it can't leverage the RCTBridgeProxy class.

Comment on lines 89 to 91
if (bridgeProxy != nil) {
return [[bridgeProxy moduleForName:RCTNSStringFromString(componentName) lazilyLoadIfNecessary:YES] class];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be removed. 0.72 does not have bridgeless and thus it can't leverage the RCTBridgeProxy class.

Summary:
This should fix
#37905 (comment)

When working on react-native-fast-image, we realized that the interop layer does not work for components where the exported name is different from the iOS class.

To fix this, we can use the Bridge to retrieve the actual view manager, given the component name.

This solution should be much more robust than making assumptions on the ViewManager name, given the ComponentName.

On top of that, we realized tha the interop layer was not calling `didSetProps` after setting the props, so we are invoking that.

bypass-github-export-checks

[iOS][Fixed] - Add support for Components with custom names in the interop layer.

Pull Request resolved: #41207

Test Plan: Tested locally on an app created in 0.72 and 0.73 in Bridge and Bridgeless mode.

Reviewed By: cortinico

Differential Revision: D50698172

Pulled By: cipolleschi

fbshipit-source-id: 49aee905418515b0204febbbe6a67c0114f37029
@analysis-bot
Copy link

analysis-bot commented Nov 8, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,492,330 -9,149,517
android hermes armeabi-v7a 7810352 n/a
android hermes x86 8962361 n/a
android hermes x86_64 8823753 n/a
android jsc arm64-v8a 9,151,475 -11,870,134
android jsc armeabi-v7a 8341169 n/a
android jsc x86 9204656 n/a
android jsc x86_64 9463476 n/a

Base commit: 47f773e
Branch: main

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: Shopify Partner: Shopify Partner Pick Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants