-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Rework modal to be implemented entirely using public APIs #14256
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
Changes from all commits
c4c6699
7b630b6
ab100c2
4d60990
fa2f6ed
2beb8c4
ea55f07
12c9808
e0e1a40
6950636
2273c7a
1f7c367
0a939ab
bf6683d
092bcb2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "Rework modal implementation to use public APIs", | ||
| "packageName": "react-native-windows", | ||
| "email": "30809111+acoates-ms@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,9 +142,8 @@ struct CompositionInputKeyboardSource : winrt::implements< | |
|
|
||
| CompositionEventHandler::CompositionEventHandler( | ||
| const winrt::Microsoft::ReactNative::ReactContext &context, | ||
| const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland, | ||
| const int fragmentTag) | ||
| : m_fragmentTag(fragmentTag), m_context(context), m_wkRootView(reactNativeIsland) {} | ||
| const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland) | ||
| : m_context(context), m_wkRootView(reactNativeIsland) {} | ||
|
|
||
| void CompositionEventHandler::Initialize() noexcept { | ||
| #ifdef USE_WINUI3 | ||
|
|
@@ -348,11 +347,8 @@ facebook::react::SurfaceId CompositionEventHandler::SurfaceId() const noexcept { | |
|
|
||
| winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView & | ||
| CompositionEventHandler::RootComponentView() const noexcept { | ||
| auto rootComponentViewDescriptor = (::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties())) | ||
| ->GetViewRegistry() | ||
| .componentViewDescriptorWithTag(SurfaceId()); | ||
| return *rootComponentViewDescriptor.view | ||
| .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>(); | ||
| auto island = m_wkRootView.get(); | ||
| return *winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->GetComponentView(); | ||
| } | ||
|
|
||
| void CompositionEventHandler::onPointerWheelChanged( | ||
|
|
@@ -365,6 +361,9 @@ void CompositionEventHandler::onPointerWheelChanged( | |
| facebook::react::Point ptLocal; | ||
| facebook::react::Point ptScaled = {static_cast<float>(position.X), static_cast<float>(position.Y)}; | ||
|
|
||
| // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we | ||
| // need to apply the current origin | ||
| ptScaled += RootComponentView().layoutMetrics().frame.origin; | ||
| auto tag = RootComponentView().hitTest(ptScaled, ptLocal); | ||
|
|
||
| if (tag == -1) | ||
|
|
@@ -977,6 +976,11 @@ void CompositionEventHandler::getTargetPointerArgs( | |
| tag = -1; | ||
|
|
||
| ptScaled = {position.X, position.Y}; | ||
|
|
||
| // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we need | ||
| // to apply the current origin | ||
| ptScaled += RootComponentView().layoutMetrics().frame.origin; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment says the hitTest pt is taken in parent coordinates and we're incorporating the origin in the subrootview (separate window) for it hit test... for the other lines I was thinking "should this origin be incorporated inside hitTest instead of called before it, if it's the RootComponentView()'s layoutMetrics?" ... then saw the Is the underlying type of |
||
|
|
||
| if (std::find(m_capturedPointers.begin(), m_capturedPointers.end(), pointerId) != m_capturedPointers.end()) { | ||
| assert(m_pointerCapturingComponentTag != -1); | ||
| tag = m_pointerCapturingComponentTag; | ||
|
|
@@ -989,30 +993,7 @@ void CompositionEventHandler::getTargetPointerArgs( | |
| ptLocal.y = ptScaled.y - (clientRect.top / strongRootView.ScaleFactor()); | ||
| } | ||
| } else { | ||
| if (m_fragmentTag == -1) { | ||
| tag = RootComponentView().hitTest(ptScaled, ptLocal); | ||
| return; | ||
| } | ||
|
|
||
| // check if the fragment tag exists | ||
| if (!fabricuiManager->GetViewRegistry().findComponentViewWithTag(m_fragmentTag)) { | ||
| return; | ||
| } | ||
|
|
||
| auto fagmentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_fragmentTag).view; | ||
| auto fagmentchildren = fagmentView.Children(); | ||
|
|
||
| // call the hitTest with the fargment as the RootComponent | ||
| for (auto index = fagmentchildren.Size(); index > 0; index--) { | ||
| auto childView = fagmentchildren.GetAt(index - 1); | ||
| auto targetTag = | ||
| winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childView)->hitTest( | ||
| ptScaled, ptLocal); | ||
| if (targetTag != -1) { | ||
| tag = targetTag; | ||
| break; | ||
| } | ||
| } | ||
| tag = RootComponentView().hitTest(ptScaled, ptLocal); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.