Skip to content

Migrate needsCustomLayoutForChildren check to the new architecture - #34254

Closed
grahammendick wants to merge 7 commits into
react:mainfrom
grahammendick:issue-34120
Closed

Migrate needsCustomLayoutForChildren check to the new architecture#34254
grahammendick wants to merge 7 commits into
react:mainfrom
grahammendick:issue-34120

Conversation

@grahammendick

@grahammendickgrahammendick commented Jul 23, 2022

Copy link
Copy Markdown
Contributor

Summary

Fixes#34120

The new React Native architecture doesn't check needsCustomLayoutForChildren so it wrongly positions native views on Android. In #34120 there are videos comparing the positioning of a native action view in the old and the new architecture.

This PR passes the parent tag to the updateLayout method of the SurfaceMountingManager. The SurfaceMountingManager calls needsCustomLayoutForChildren on the parent view manager (copied the code from the NativeViewHierarchyManager in the old architecture).

NOTE - I wasn't sure where to get the parent shadow view from so I've put in my best guesses where I could and left it as {} otherwise.

Changelog

[Android] [Fixed] - Migrate needsCustomLayoutForChildren check to the new architecture

Test Plan

I checked the fix in the repro from #34165. Here is a video of the action view closing using the native button that is now visible in the new architecture.

Screen.Recording.2022-07-23.at.14.39.10.mov

It's not working but it's a good first go. Tried to pass parent tag to the surface mounting manager - then implement call to needsCustomLayoutForChildren like in NativeViewHierarchyManager of old arch
@facebook-github-botfacebook-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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 23, 2022
@analysis-bot

analysis-bot commented Jul 23, 2022

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
ios-universaln/a--

Base commit: 0ce4ea2
Branch: main

The create mutation has the parent but the update doesn't so couldn't pass the parent tag to the surface manager on update
@analysis-bot

analysis-bot commented Jul 23, 2022

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a7,827,064-44
androidhermesarmeabi-v7a7,218,176+146
androidhermesx868,139,373-139
androidhermesx86_648,118,059+446
androidjscarm64-v8a9,704,444+111
androidjscarmeabi-v7a8,459,166+321
androidjscx869,654,991+28
androidjscx86_6410,253,425+614

Base commit: 0ce4ea2
Branch: main

Comment threadReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp Outdated
@facebook-github-bot

Copy link
Copy Markdown
Contributor

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

@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @grahammendick in e24ce70.

When will my fix make it into a release? | Upcoming Releases

@react-native-botreact-native-bot added the Merged This PR has been merged. label Jul 28, 2022
@grahammendick

Copy link
Copy Markdown
ContributorAuthor

@javache Thank you for your help and for merging it so quickly 👍

roryabraham pushed a commit to Expensify/react-native that referenced this pull request Aug 17, 2022
…eact#34254)
Summary:
Fixesreact#34120
The new React Native architecture doesn't check `needsCustomLayoutForChildren` so it wrongly positions native views on Android. In react#34120 there are videos comparing the positioning of a native action view in the old and the new architecture.
This PR passes the parent tag to the `updateLayout` method of the `SurfaceMountingManager`. The `SurfaceMountingManager` calls `needsCustomLayoutForChildren` on the parent view manager (copied the code from the `NativeViewHierarchyManager` in the old architecture).
**NOTE** - I wasn't sure where to get the parent shadow view from so I've put in my best guesses where I could and left it as `{}` otherwise.
## Changelog
[Android] [Fixed] - Migrate `needsCustomLayoutForChildren` check to the new architecture
Pull Request resolved: react#34254
Test Plan:
I checked the fix in the repro from react#34165. Here is a video of the action view closing using the native button that is now visible in the new architecture.
https://user-images.githubusercontent.com/1761227/180607896-35bf477f-4552-4b8a-8e09-9e8c49122c0c.mov
Reviewed By: cipolleschi
Differential Revision: D38153924
Pulled By: javache
fbshipit-source-id: e2c77fa70d725a33ce73fe4a615f6d884312580c
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.MergedThis PR has been merged.Platform: AndroidAndroid applications.Shared with MetaApplied 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.

The needsCustomLayoutForChildren check is missing from the new React Native architecture

5 participants

@grahammendick@analysis-bot@facebook-github-bot@react-native-bot@javache