Skip to content

fix: make it possible to add multiple mountingOverrideDelegates#44927

Closed
WoLewicki wants to merge 3 commits into
facebook:mainfrom
WoLewicki:@wolewicki/add-multiple-mounting-override-delegates
Closed

fix: make it possible to add multiple mountingOverrideDelegates#44927
WoLewicki wants to merge 3 commits into
facebook:mainfrom
WoLewicki:@wolewicki/add-multiple-mounting-override-delegates

Conversation

@WoLewicki
Copy link
Copy Markdown
Contributor

Summary:

PR changing the single mountingOverrideDelegate to a vector of those, so other listeners can operate on the transaction. Used by react-native-screens in software-mansion/react-native-screens#2134 and react-native-reanimated in software-mansion/react-native-reanimated#6055.

Till now, only one listener could be added there, meaning that e.g. Layout Animations from react-native, Layout Animations from react-native-reanimated and listening for Screen removal in react-native-screens could not operate at the same time.

Changelog:

[GENERAL] [FIXED] - Add option for multiple mountingOverrideDelegates

Test Plan:

The code of LayoutAnimations inside react-native should work the same since it will add just one listener then. For other cases, different libraries can read/mutate transactions.

@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: 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 Jun 13, 2024
@WoLewicki
Copy link
Copy Markdown
Contributor Author

I am aware that the name of the method should be probably changed from setMountingOverrideDelegate to addMountingOverrideDelegate but this way we keep the compatibility between versions.

Comment thread packages/react-native/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp Outdated
@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jun 13, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 20,365,514 +993
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 23,569,569 -62
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 8b53d41
Branch: main

@@ -203,7 +206,7 @@ ShadowTreeRevision MountingCoordinator::getBaseRevision() const {
void MountingCoordinator::setMountingOverrideDelegate(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldn't this be renamed to 'addMountingOverrideDelegate'?

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sammy-SC has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@sammy-SC
Copy link
Copy Markdown
Contributor

looks good. I'm importing the diff. If you manage to do the rename, that's great. Otherwise, it can be done in subsequent diff.

Thank you

@WoLewicki
Copy link
Copy Markdown
Contributor Author

As mentioned in #44927 (comment), not changing the name would make it work for different RN versions, but since we don't care too much about it on new arch right now, I'll change it 😅

@WoLewicki
Copy link
Copy Markdown
Contributor Author

@sammy-SC changed from set to add.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@sammy-SC merged this pull request in 358fe46.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 14, 2024
@github-actions
Copy link
Copy Markdown

This pull request was successfully merged by @WoLewicki in 358fe46.

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. Merged This PR has been merged. 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.

5 participants