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

Migrate needsCustomLayoutForChildren check to the new architecture #34254

Closed
wants to merge 7 commits into from

Conversation

grahammendick
Copy link
Contributor

@grahammendick grahammendick commented Jul 23, 2022

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-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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jul 23, 2022
@react-native-bot react-native-bot added Bug Platform: Android Android applications. labels Jul 23, 2022
@analysis-bot
Copy link

analysis-bot commented Jul 23, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/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
Copy link

analysis-bot commented Jul 23, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,827,064 -44
android hermes armeabi-v7a 7,218,176 +146
android hermes x86 8,139,373 -139
android hermes x86_64 8,118,059 +446
android jsc arm64-v8a 9,704,444 +111
android jsc armeabi-v7a 8,459,166 +321
android jsc x86 9,654,991 +28
android jsc x86_64 10,253,425 +614

Base commit: 0ce4ea2
Branch: main

@facebook-github-bot
Copy link
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
Collaborator

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

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

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

@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
…acebook#34254)

Summary:
Fixes facebook#34120

The new React Native architecture doesn't check `needsCustomLayoutForChildren` so it wrongly positions native views on Android. In facebook#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: facebook#34254

Test Plan:
I checked the fix in the repro from facebook#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
roryabraham pushed a commit to Expensify/react-native that referenced this pull request Aug 17, 2022
…acebook#34254)

Summary:
Fixes facebook#34120

The new React Native architecture doesn't check `needsCustomLayoutForChildren` so it wrongly positions native views on Android. In facebook#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: facebook#34254

Test Plan:
I checked the fix in the repro from facebook#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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 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. Platform: Android Android applications. 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.

The needsCustomLayoutForChildren check is missing from the new React Native architecture
5 participants