microsoft / microsoft/react-native-windows
Remove assumptions that XamlRoot::Content() matches Window size
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
Problem Description
There are at least two callsites that assume that the XamlRoot Size or the ActualSize of the XamlRoot::Content matches the size of the XAML Islands HWND:
- https://github.com/microsoft/react-native-windows/blob/003602b90aeda1b2a43702c6a9307c0f01010e59/vnext/Microsoft.ReactNative/Modules/LogBoxModule.cpp#L48-L54
- https://github.com/microsoft/react-native-windows/blob/cc7095ce487625a9a0a9b99b4b8df4043698eb78/vnext/Microsoft.ReactNative/Modules/AlertModule.cpp#L67-L85
While this is generally a good assumption, this may not always be the case. For example, in our app, we've worked around a XAML Islands bug https://github.com/microsoft/microsoft-ui-xaml/issues/2101 by making the root Grid larger than the HWND by a factor equivalent to the DPI scale factor.
Steps To Reproduce
There's no immediate repro in this repo, but one way to repro is to try and build a drag and drop handler for a XAML Islands react-native-windows app, and see that the full window is not a valid drop target for high DPI scale settings.
Expected Results
React Native Windows may want to assume that the root level content or XamlRoot matches the HWND size by default, but we should allow apps to override this behavior with a "window sizing root" target element that does match the window size.
CLI version
npx react-native --version
Environment
npx react-native info
Target Platform Version
No response
Target Device(s)
No response
Visual Studio Version
No response
Build Configuration
No response
Snack, code example, screenshot, or link to a repository
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the cited callsites in vnext/Microsoft.ReactNative/Modules/LogBoxModule.cpp and AlertModule.cpp, focusing on their use of XamlRoot size or XamlRoot::Content(). Define how an overridable window-sizing root target should work, then verify that both callsites no longer require root content or XamlRoot dimensions to match the HWND size.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, react-native
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100