microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.35k stars 1.14k forks source link

Remove assumptions that XamlRoot::Content() matches Window size #10211

Open rozele opened 2 years ago

rozele commented 2 years ago

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:

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

asklar commented 2 years ago

Discussed a bit in triage, several possible options/concerns. Alert module should support both Win32 style modal dialog as well as the UWP style (smoke screen). Needs design. @stmoy ?

lyahdav commented 2 years ago

@rozele I think the PR description has an incomplete sentence:

As such, we need to