-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add root tag to ShadowNode for resolving correct XamlRoot in FlyoutViewManager #8327
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
Conversation
There are a number of places where a single root view assumption exists in the app. Currently, there is no way to know which root view a Flyout will be shown on, which can be problematic when each root is on a different window. This is the first step to supporting multiple root views. Towards microsoft#8250
|
We may not need the change to CreateViewCore actually... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My main concern with this is it's 8 additional bytes per shadow node for one very specific scenario.
Perhaps a better approach is to wire the rootTag from the UIManager.createView method (as had done previously then reverted) to avoid the memory penalty.
If no one else is opposed to the 8 additional bytes, then we can push this as is though ;)
|
Looks like the build failure is due to some flakiness with nuget. |
I might be misinterpreting the code, but would be be possible to traverse parents to discover root tag? |
I don't think so. I believe we can potentially show the Flyout at the time createView is called, at which point it's not parented in the ShadowNode hierarchy. Specifically, we call ShowAt from this point in
createView here: react-native-windows/vnext/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp Line 142 in c6087b5
ViewManagerBase::OnLayout in some instances, but this call is too frequent and requires extra state to know that you only want to do something the first time OnLayout is called.
|
|
Apologies for not taking a look at this sooner. Have been juggling a couple different things atm. I think I better understand the problem. I think embedding root tag into shadow node is reasonable if we need to perform actions when not yet parented. It feels like a lot of state to duplicate though. You had mentioned there weren't good signals of when the shadow node is parented. I think it would be reasonable to expose that. E.g. calling shadownode "onParented" callback in UIManager setChildren or manageChildren. |
|
Hmm... Thinking about that more, it's possible a shadownode could be parented to a different unparanted shadow node... Tracking root in Shadownode seems reasonable to me then. |
|
IIRC, we were still discussing how modules can do this in an ABI safe way (though XamlUIService or similar). Do we have a tracking issue for that or do we need one? @rozele |
Apologies, I had originally planned to include ABI changes for root tag, but decided it was probably better to solve the FlyoutViewManager first as this was our most immediate need. I re-opened #8250 which was intended to cover that scenario. |
In microsoft#8327, we added a root tag field to the ShadowNode. Rather than relying on a parent traversal to find the parent node, we can just directly resolve the root using the root tag.
In microsoft#8327, we added a root tag field to the ShadowNode. Rather than relying on a parent traversal to find the parent node, we can just directly resolve the root using the root tag.
In microsoft#8327, we added a root tag field to the ShadowNode. Rather than relying on a parent traversal to find the parent node, we can just directly resolve the root using the root tag.
* Simplify root node lookups In #8327, we added a root tag field to the ShadowNode. Rather than relying on a parent traversal to find the parent node, we can just directly resolve the root using the root tag. * Change files
There are a number of places where a single root view assumption exists in the app. Currently, there is no way to specifiy the correct XamlRoot for FlyoutViewManager. This is a minimal change to add rootTag to shadow node, add an API to the NativeUIManager to get a specific XamlRoot for a ReactRootView, and update FlyoutViewManager to grab the specific XamlRoot for the root view it lives under.
Fixes #8250
Fixes #6714
Microsoft Reviewers: Open in CodeFlow