react-native-windows 0.74.20 → 0.74.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Microsoft.ReactNative/ComponentView.idl +44 -32
- package/Microsoft.ReactNative/Composition.Input.idl +3 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +334 -65
- package/Microsoft.ReactNative/Fabric/ComponentView.h +162 -38
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +29 -7
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +23 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +118 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +129 -106
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +31 -54
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +9 -8
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +3 -5
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +137 -56
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +21 -4
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +45 -10
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +9 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +209 -189
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +22 -10
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +4 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +115 -168
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +11 -14
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +14 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +12 -4
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +338 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +56 -4
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -4
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +40 -9
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +4 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +25 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +64 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +104 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +78 -0
- package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +17 -1
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
- package/Microsoft.ReactNative/Timer.idl +1 -1
- package/Microsoft.ReactNative/packages.lock.json +0 -10
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Shared.vcxitems +43 -0
- package/Shared/Shared.vcxitems.filters +3 -0
- package/Shared/TurboModuleManager.cpp +0 -3
- package/just-task.js +1 -1
- package/package.json +3 -3
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +1 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "ContentIslandComponentView.h"
|
|
8
|
+
|
|
9
|
+
#include <Fabric/FabricUIManagerModule.h>
|
|
10
|
+
#include <IReactContext.h>
|
|
11
|
+
#include <UI.Xaml.Controls.h>
|
|
12
|
+
#include <Utils/ValueUtils.h>
|
|
13
|
+
#include <winrt/Microsoft.UI.Content.h>
|
|
14
|
+
#include <winrt/Windows.UI.Composition.h>
|
|
15
|
+
#include "CompositionContextHelper.h"
|
|
16
|
+
#include "RootComponentView.h"
|
|
17
|
+
|
|
18
|
+
#include "Composition.ContentIslandComponentView.g.cpp"
|
|
19
|
+
|
|
20
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
21
|
+
|
|
22
|
+
ContentIslandComponentView::ContentIslandComponentView(
|
|
23
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
24
|
+
facebook::react::Tag tag,
|
|
25
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext)
|
|
26
|
+
: base_type(ViewComponentView::defaultProps(), compContext, tag, reactContext, ComponentViewFeatures::Default) {
|
|
27
|
+
m_mountedToken = Mounted([](const winrt::IInspectable &, const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
28
|
+
view.as<ContentIslandComponentView>()->OnMounted();
|
|
29
|
+
});
|
|
30
|
+
m_unmountedToken =
|
|
31
|
+
Unmounted([](const winrt::IInspectable &, const winrt::Microsoft::ReactNative::ComponentView &view) {
|
|
32
|
+
view.as<ContentIslandComponentView>()->OnUnmounted();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void ContentIslandComponentView::OnMounted() noexcept {
|
|
37
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
38
|
+
m_childContentLink = winrt::Microsoft::UI::Content::ChildContentLink::Create(
|
|
39
|
+
rootComponentView()->parentContentIsland(),
|
|
40
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::CompositionContextHelper::InnerVisual(Visual())
|
|
41
|
+
.as<winrt::Microsoft::UI::Composition::ContainerVisual>());
|
|
42
|
+
m_childContentLink.ActualSize({m_layoutMetrics.frame.size.width, m_layoutMetrics.frame.size.height});
|
|
43
|
+
if (m_islandToConnect) {
|
|
44
|
+
m_childContentLink.Connect(m_islandToConnect);
|
|
45
|
+
m_islandToConnect = nullptr;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ParentLayoutChanged();
|
|
49
|
+
auto view = Parent();
|
|
50
|
+
while (view) {
|
|
51
|
+
m_layoutMetricChangedRevokers.push_back(view.LayoutMetricsChanged(
|
|
52
|
+
winrt::auto_revoke,
|
|
53
|
+
[wkThis = get_weak()](
|
|
54
|
+
const winrt::IInspectable &sender, const winrt::Microsoft::ReactNative::LayoutMetricsChangedArgs &args) {
|
|
55
|
+
if (auto strongThis = wkThis.get()) {
|
|
56
|
+
strongThis->ParentLayoutChanged();
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
view = view.Parent();
|
|
60
|
+
}
|
|
61
|
+
#endif
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void ContentIslandComponentView::OnUnmounted() noexcept {
|
|
65
|
+
m_layoutMetricChangedRevokers.clear();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
void ContentIslandComponentView::ParentLayoutChanged() noexcept {
|
|
69
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
70
|
+
if (m_layoutChangePosted)
|
|
71
|
+
return;
|
|
72
|
+
|
|
73
|
+
m_layoutChangePosted = true;
|
|
74
|
+
ReactContext().UIDispatcher().Post([wkThis = get_weak()]() {
|
|
75
|
+
if (auto strongThis = wkThis.get()) {
|
|
76
|
+
auto clientRect = strongThis->getClientRect();
|
|
77
|
+
|
|
78
|
+
strongThis->m_childContentLink.OffsetOverride(
|
|
79
|
+
{static_cast<float>(clientRect.left), static_cast<float>(clientRect.top)});
|
|
80
|
+
strongThis->m_layoutChangePosted = false;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
#endif
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
ContentIslandComponentView::~ContentIslandComponentView() noexcept {
|
|
87
|
+
if (m_islandToConnect) {
|
|
88
|
+
m_islandToConnect.Close();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
void ContentIslandComponentView::MountChildComponentView(
|
|
93
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
94
|
+
uint32_t index) noexcept {
|
|
95
|
+
assert(false);
|
|
96
|
+
base_type::MountChildComponentView(childComponentView, index);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
void ContentIslandComponentView::UnmountChildComponentView(
|
|
100
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
101
|
+
uint32_t index) noexcept {
|
|
102
|
+
assert(false);
|
|
103
|
+
base_type::UnmountChildComponentView(childComponentView, index);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void ContentIslandComponentView::updateLayoutMetrics(
|
|
107
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
108
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept {
|
|
109
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
110
|
+
if (m_childContentLink) {
|
|
111
|
+
m_childContentLink.ActualSize({layoutMetrics.frame.size.width, layoutMetrics.frame.size.height});
|
|
112
|
+
ParentLayoutChanged();
|
|
113
|
+
}
|
|
114
|
+
#endif
|
|
115
|
+
base_type::updateLayoutMetrics(layoutMetrics, oldLayoutMetrics);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
void ContentIslandComponentView::Connect(const winrt::Microsoft::UI::Content::ContentIsland &contentIsland) noexcept {
|
|
119
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
120
|
+
if (m_childContentLink) {
|
|
121
|
+
m_islandToConnect = nullptr;
|
|
122
|
+
m_childContentLink.Connect(contentIsland);
|
|
123
|
+
} else {
|
|
124
|
+
m_islandToConnect = contentIsland;
|
|
125
|
+
}
|
|
126
|
+
#endif
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
void ContentIslandComponentView::prepareForRecycle() noexcept {
|
|
130
|
+
Super::prepareForRecycle();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <Fabric/ComponentView.h>
|
|
8
|
+
|
|
9
|
+
#include <Microsoft.ReactNative.Cxx/ReactContext.h>
|
|
10
|
+
#include <winrt/Microsoft.UI.Content.h>
|
|
11
|
+
#include <winrt/Windows.UI.Composition.h>
|
|
12
|
+
#include "CompositionHelpers.h"
|
|
13
|
+
#include "CompositionViewComponentView.h"
|
|
14
|
+
|
|
15
|
+
#pragma warning(push)
|
|
16
|
+
#pragma warning(disable : 4244 4305)
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
#pragma warning(pop)
|
|
19
|
+
#include "Composition.ContentIslandComponentView.g.h"
|
|
20
|
+
|
|
21
|
+
namespace winrt::Microsoft::ReactNative::Composition::implementation {
|
|
22
|
+
|
|
23
|
+
struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandComponentView, ViewComponentView> {
|
|
24
|
+
using Super = ContentIslandComponentViewT<ContentIslandComponentView, ViewComponentView>;
|
|
25
|
+
|
|
26
|
+
void MountChildComponentView(
|
|
27
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
28
|
+
uint32_t index) noexcept override;
|
|
29
|
+
void UnmountChildComponentView(
|
|
30
|
+
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
31
|
+
uint32_t index) noexcept override;
|
|
32
|
+
void Connect(const winrt::Microsoft::UI::Content::ContentIsland &contentIsland) noexcept;
|
|
33
|
+
|
|
34
|
+
void updateLayoutMetrics(
|
|
35
|
+
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
36
|
+
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept;
|
|
37
|
+
|
|
38
|
+
void prepareForRecycle() noexcept override;
|
|
39
|
+
|
|
40
|
+
ContentIslandComponentView(
|
|
41
|
+
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
42
|
+
facebook::react::Tag tag,
|
|
43
|
+
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
44
|
+
~ContentIslandComponentView() noexcept;
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
void OnMounted() noexcept;
|
|
48
|
+
void OnUnmounted() noexcept;
|
|
49
|
+
void ParentLayoutChanged() noexcept;
|
|
50
|
+
|
|
51
|
+
bool m_layoutChangePosted{false};
|
|
52
|
+
winrt::Microsoft::UI::Content::ContentIsland m_islandToConnect{nullptr};
|
|
53
|
+
winrt::event_token m_mountedToken;
|
|
54
|
+
winrt::event_token m_unmountedToken;
|
|
55
|
+
std::vector<winrt::Microsoft::ReactNative::ComponentView::LayoutMetricsChanged_revoker> m_layoutMetricChangedRevokers;
|
|
56
|
+
#ifdef USE_EXPERIMENTAL_WINUI3
|
|
57
|
+
winrt::Microsoft::UI::Content::ChildContentLink m_childContentLink{nullptr};
|
|
58
|
+
#endif
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -21,8 +21,7 @@ DebuggingOverlayComponentView::DebuggingOverlayComponentView(
|
|
|
21
21
|
reactContext,
|
|
22
22
|
ComponentViewFeatures::Default &
|
|
23
23
|
~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
|
|
24
|
-
ComponentViewFeatures::NativeBorder)
|
|
25
|
-
false) {}
|
|
24
|
+
ComponentViewFeatures::NativeBorder)) {}
|
|
26
25
|
|
|
27
26
|
void DebuggingOverlayComponentView::MountChildComponentView(
|
|
28
27
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
@@ -68,17 +67,21 @@ struct TraceUpdate {
|
|
|
68
67
|
};
|
|
69
68
|
|
|
70
69
|
void DebuggingOverlayComponentView::HandleCommand(
|
|
71
|
-
winrt::
|
|
72
|
-
|
|
70
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
|
|
71
|
+
base_type::HandleCommand(args);
|
|
72
|
+
if (args.Handled())
|
|
73
|
+
return;
|
|
74
|
+
|
|
75
|
+
auto commandName = args.CommandName();
|
|
73
76
|
if (commandName == L"highlightTraceUpdates") {
|
|
74
77
|
std::vector<TraceUpdate> updates;
|
|
75
|
-
winrt::Microsoft::ReactNative::ReadArgs(args, updates);
|
|
78
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), updates);
|
|
76
79
|
// TODO should create visuals that get removed after 2 seconds
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
79
82
|
if (commandName == L"highlightElements") {
|
|
80
83
|
std::vector<ElementRectangle> elements;
|
|
81
|
-
winrt::Microsoft::ReactNative::ReadArgs(args, elements);
|
|
84
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), elements);
|
|
82
85
|
|
|
83
86
|
if (auto root = rootComponentView()) {
|
|
84
87
|
auto rootVisual = root->OuterVisual();
|
|
@@ -107,8 +110,6 @@ void DebuggingOverlayComponentView::HandleCommand(
|
|
|
107
110
|
}
|
|
108
111
|
return;
|
|
109
112
|
}
|
|
110
|
-
|
|
111
|
-
base_type::HandleCommand(commandName, args);
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -29,8 +29,7 @@ struct DebuggingOverlayComponentView
|
|
|
29
29
|
facebook::react::Tag tag,
|
|
30
30
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext);
|
|
31
31
|
|
|
32
|
-
void HandleCommand(
|
|
33
|
-
override;
|
|
32
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
|
|
34
33
|
|
|
35
34
|
private:
|
|
36
35
|
uint32_t m_activeOverlays{0};
|
|
@@ -22,19 +22,26 @@ int32_t GotFocusEventArgs::OriginalSource() noexcept {
|
|
|
22
22
|
|
|
23
23
|
LosingFocusEventArgs::LosingFocusEventArgs(
|
|
24
24
|
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
25
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
|
|
25
26
|
const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
|
|
26
27
|
const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent)
|
|
27
28
|
: m_originalSource(originalSource ? originalSource.Tag() : -1),
|
|
29
|
+
m_direction(direction),
|
|
28
30
|
m_old(oldFocusedComponent),
|
|
29
31
|
m_new(newFocusedComponent) {}
|
|
30
32
|
|
|
31
|
-
int32_t LosingFocusEventArgs::OriginalSource() noexcept {
|
|
33
|
+
int32_t LosingFocusEventArgs::OriginalSource() const noexcept {
|
|
32
34
|
return m_originalSource;
|
|
33
35
|
}
|
|
34
|
-
|
|
36
|
+
|
|
37
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection LosingFocusEventArgs::Direction() const noexcept {
|
|
38
|
+
return m_direction;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::NewFocusedComponent() const noexcept {
|
|
35
42
|
return m_new;
|
|
36
43
|
}
|
|
37
|
-
winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::OldFocusedComponent() noexcept {
|
|
44
|
+
winrt::Microsoft::ReactNative::ComponentView LosingFocusEventArgs::OldFocusedComponent() const noexcept {
|
|
38
45
|
return m_old;
|
|
39
46
|
}
|
|
40
47
|
|
|
@@ -58,19 +65,26 @@ void LosingFocusEventArgs::TrySetNewFocusedComponent(
|
|
|
58
65
|
|
|
59
66
|
GettingFocusEventArgs::GettingFocusEventArgs(
|
|
60
67
|
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
68
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
|
|
61
69
|
const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
|
|
62
70
|
const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent)
|
|
63
71
|
: m_originalSource(originalSource ? originalSource.Tag() : -1),
|
|
72
|
+
m_direction(direction),
|
|
64
73
|
m_old(oldFocusedComponent),
|
|
65
74
|
m_new(newFocusedComponent) {}
|
|
66
75
|
|
|
67
|
-
int32_t GettingFocusEventArgs::OriginalSource() noexcept {
|
|
76
|
+
int32_t GettingFocusEventArgs::OriginalSource() const noexcept {
|
|
68
77
|
return m_originalSource;
|
|
69
78
|
}
|
|
70
|
-
|
|
79
|
+
|
|
80
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection GettingFocusEventArgs::Direction() const noexcept {
|
|
81
|
+
return m_direction;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::NewFocusedComponent() const noexcept {
|
|
71
85
|
return m_new;
|
|
72
86
|
}
|
|
73
|
-
winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::OldFocusedComponent() noexcept {
|
|
87
|
+
winrt::Microsoft::ReactNative::ComponentView GettingFocusEventArgs::OldFocusedComponent() const noexcept {
|
|
74
88
|
return m_old;
|
|
75
89
|
}
|
|
76
90
|
|
|
@@ -32,17 +32,21 @@ struct LosingFocusEventArgs
|
|
|
32
32
|
: winrt::Microsoft::ReactNative::implementation::LosingFocusEventArgsT<LosingFocusEventArgs> {
|
|
33
33
|
LosingFocusEventArgs(
|
|
34
34
|
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
35
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
|
|
35
36
|
const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
|
|
36
37
|
const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent);
|
|
37
|
-
int32_t OriginalSource() noexcept;
|
|
38
|
-
winrt::Microsoft::ReactNative::
|
|
39
|
-
|
|
38
|
+
int32_t OriginalSource() const noexcept;
|
|
39
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection Direction() const noexcept;
|
|
40
|
+
|
|
41
|
+
winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() const noexcept;
|
|
42
|
+
winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() const noexcept;
|
|
40
43
|
|
|
41
44
|
void TryCancel() noexcept;
|
|
42
45
|
void TrySetNewFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent) noexcept;
|
|
43
46
|
|
|
44
47
|
private:
|
|
45
48
|
const int32_t m_originalSource;
|
|
49
|
+
const winrt::Microsoft::ReactNative::FocusNavigationDirection m_direction;
|
|
46
50
|
winrt::Microsoft::ReactNative::ComponentView m_old{nullptr};
|
|
47
51
|
winrt::Microsoft::ReactNative::ComponentView m_new{nullptr};
|
|
48
52
|
};
|
|
@@ -51,17 +55,20 @@ struct GettingFocusEventArgs
|
|
|
51
55
|
: winrt::Microsoft::ReactNative::implementation::GettingFocusEventArgsT<GettingFocusEventArgs> {
|
|
52
56
|
GettingFocusEventArgs(
|
|
53
57
|
const winrt::Microsoft::ReactNative::ComponentView &originalSource,
|
|
58
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection direction,
|
|
54
59
|
const winrt::Microsoft::ReactNative::ComponentView &oldFocusedComponent,
|
|
55
60
|
const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent);
|
|
56
|
-
int32_t OriginalSource() noexcept;
|
|
57
|
-
winrt::Microsoft::ReactNative::
|
|
58
|
-
winrt::Microsoft::ReactNative::ComponentView
|
|
61
|
+
int32_t OriginalSource() const noexcept;
|
|
62
|
+
winrt::Microsoft::ReactNative::FocusNavigationDirection Direction() const noexcept;
|
|
63
|
+
winrt::Microsoft::ReactNative::ComponentView NewFocusedComponent() const noexcept;
|
|
64
|
+
winrt::Microsoft::ReactNative::ComponentView OldFocusedComponent() const noexcept;
|
|
59
65
|
|
|
60
66
|
void TryCancel() noexcept;
|
|
61
67
|
void TrySetNewFocusedComponent(const winrt::Microsoft::ReactNative::ComponentView &newFocusedComponent) noexcept;
|
|
62
68
|
|
|
63
69
|
private:
|
|
64
70
|
const int32_t m_originalSource;
|
|
71
|
+
const winrt::Microsoft::ReactNative::FocusNavigationDirection m_direction;
|
|
65
72
|
winrt::Microsoft::ReactNative::ComponentView m_old{nullptr};
|
|
66
73
|
winrt::Microsoft::ReactNative::ComponentView m_new{nullptr};
|
|
67
74
|
};
|
|
@@ -70,8 +70,7 @@ ImageComponentView::ImageComponentView(
|
|
|
70
70
|
compContext,
|
|
71
71
|
tag,
|
|
72
72
|
reactContext,
|
|
73
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
74
|
-
false) {}
|
|
73
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {}
|
|
75
74
|
|
|
76
75
|
void ImageComponentView::MountChildComponentView(
|
|
77
76
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
@@ -185,7 +184,6 @@ void ImageComponentView::prepareForRecycle() noexcept {
|
|
|
185
184
|
winrt::Microsoft::ReactNative::ImageProps ImageComponentView::ImageProps() noexcept {
|
|
186
185
|
// We do not currently support custom ImageComponentView's
|
|
187
186
|
// If we did we would need to create a AbiImageProps and possibly return them here
|
|
188
|
-
assert(!m_customComponent);
|
|
189
187
|
return winrt::make<winrt::Microsoft::ReactNative::implementation::ImageProps>(viewProps());
|
|
190
188
|
}
|
|
191
189
|
|
|
@@ -196,7 +194,6 @@ winrt::Microsoft::ReactNative::ImageProps ImageComponentView::ViewProps() noexce
|
|
|
196
194
|
winrt::Microsoft::ReactNative::ViewProps ImageComponentView::ViewPropsInner() noexcept {
|
|
197
195
|
// We do not currently support custom ImageComponentView's
|
|
198
196
|
// If we did we would need to create a AbiImageProps and possibly return them here
|
|
199
|
-
assert(!m_customComponent);
|
|
200
197
|
return winrt::make<winrt::Microsoft::ReactNative::implementation::ImageProps>(viewProps());
|
|
201
198
|
}
|
|
202
199
|
|
package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp
CHANGED
|
@@ -27,8 +27,7 @@ WindowsModalHostComponentView::WindowsModalHostComponentView(
|
|
|
27
27
|
compContext,
|
|
28
28
|
tag,
|
|
29
29
|
reactContext,
|
|
30
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
31
|
-
false) {
|
|
30
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {
|
|
32
31
|
m_context = reactContext; // save context
|
|
33
32
|
}
|
|
34
33
|
|
|
@@ -192,9 +191,8 @@ void WindowsModalHostComponentView::UnmountChildComponentView(
|
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
void WindowsModalHostComponentView::HandleCommand(
|
|
195
|
-
winrt::
|
|
196
|
-
|
|
197
|
-
Super::HandleCommand(commandName, args);
|
|
194
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
|
|
195
|
+
Super::HandleCommand(args);
|
|
198
196
|
}
|
|
199
197
|
|
|
200
198
|
void WindowsModalHostComponentView::updateProps(
|
|
@@ -28,8 +28,7 @@ struct WindowsModalHostComponentView
|
|
|
28
28
|
void UnmountChildComponentView(
|
|
29
29
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
30
30
|
uint32_t index) noexcept override;
|
|
31
|
-
void HandleCommand(
|
|
32
|
-
override;
|
|
31
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
|
|
33
32
|
void updateState(facebook::react::State::Shared const &state, facebook::react::State::Shared const &oldState) noexcept
|
|
34
33
|
override;
|
|
35
34
|
|
|
@@ -27,8 +27,7 @@ ParagraphComponentView::ParagraphComponentView(
|
|
|
27
27
|
compContext,
|
|
28
28
|
tag,
|
|
29
29
|
reactContext,
|
|
30
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
31
|
-
false) {}
|
|
30
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {}
|
|
32
31
|
|
|
33
32
|
void ParagraphComponentView::MountChildComponentView(
|
|
34
33
|
const winrt::Microsoft::ReactNative::ComponentView &childComponentView,
|
|
@@ -68,10 +67,6 @@ void ParagraphComponentView::updateProps(
|
|
|
68
67
|
Super::updateProps(props, oldProps);
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
void ParagraphComponentView::updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept {
|
|
72
|
-
Super::updateEventEmitter(eventEmitter);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
70
|
void ParagraphComponentView::updateState(
|
|
76
71
|
facebook::react::State::Shared const &state,
|
|
77
72
|
facebook::react::State::Shared const &oldState) noexcept {
|
|
@@ -33,7 +33,6 @@ struct ParagraphComponentView : ParagraphComponentViewT<ParagraphComponentView,
|
|
|
33
33
|
uint32_t index) noexcept override;
|
|
34
34
|
void updateProps(facebook::react::Props::Shared const &props, facebook::react::Props::Shared const &oldProps) noexcept
|
|
35
35
|
override;
|
|
36
|
-
void updateEventEmitter(facebook::react::EventEmitter::Shared const &eventEmitter) noexcept override;
|
|
37
36
|
void updateLayoutMetrics(
|
|
38
37
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
39
38
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "pch.h"
|
|
5
5
|
#include "ReactCompositionViewComponentBuilder.h"
|
|
6
6
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
7
|
+
#include <Fabric/Composition/ContentIslandComponentView.h>
|
|
7
8
|
#include <strsafe.h>
|
|
8
9
|
#include "DynamicWriter.h"
|
|
9
10
|
#include "ReactHost/MsoUtils.h"
|
|
@@ -46,16 +47,74 @@ LayoutHandler ReactCompositionViewComponentBuilder::LayoutHandler() const noexce
|
|
|
46
47
|
return m_layoutHandler;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
void ReactCompositionViewComponentBuilder::
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
void ReactCompositionViewComponentBuilder::InitializeComponentView(
|
|
51
|
+
const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
52
|
+
auto self = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view);
|
|
53
|
+
self->MarkAsCustomComponent();
|
|
54
|
+
if (m_customCommandHandler)
|
|
55
|
+
self->CustomCommandHandler(m_customCommandHandler);
|
|
56
|
+
if (m_finalizeUpdateHandler)
|
|
57
|
+
self->FinalizeUpdateHandler(m_finalizeUpdateHandler);
|
|
58
|
+
if (m_updatePropsHandler)
|
|
59
|
+
self->UpdatePropsHandler(m_updatePropsHandler);
|
|
60
|
+
if (m_updateStateHandler)
|
|
61
|
+
self->UpdateStateHandler(m_updateStateHandler);
|
|
62
|
+
if (m_updateEventEmitterHandler)
|
|
63
|
+
self->UpdateEventEmitterHandler(m_updateEventEmitterHandler);
|
|
64
|
+
if (m_mountChildComponentViewHandler)
|
|
65
|
+
self->MountChildComponentViewHandler(m_mountChildComponentViewHandler);
|
|
66
|
+
if (m_unmountChildComponentViewHandler)
|
|
67
|
+
self->UnmountChildComponentViewHandler(m_unmountChildComponentViewHandler);
|
|
68
|
+
if (m_createVisualHandler)
|
|
69
|
+
view.as<winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView>()->CreateVisualHandler(
|
|
70
|
+
m_createVisualHandler);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
void ReactCompositionViewComponentBuilder::SetComponentViewInitializer(
|
|
74
|
+
const ComponentViewInitializer &initializer) noexcept {
|
|
75
|
+
m_fnCreateView =
|
|
76
|
+
[initializer](const IReactContext &reactContext, int32_t tag, const Experimental::ICompositionContext &context) {
|
|
77
|
+
auto view = winrt::make<winrt::Microsoft::ReactNative::implementation::ComponentView>(tag, reactContext);
|
|
78
|
+
initializer(view);
|
|
79
|
+
return view;
|
|
80
|
+
};
|
|
81
|
+
m_descriptorConstructorFactory = []() {
|
|
82
|
+
return &facebook::react::concreteComponentDescriptorConstructor<::Microsoft::ReactNative::AbiComponentDescriptor>;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void ReactCompositionViewComponentBuilder::SetViewComponentViewInitializer(
|
|
87
|
+
const ViewComponentViewInitializer &initializer) noexcept {
|
|
88
|
+
m_fnCreateView =
|
|
89
|
+
[initializer](const IReactContext &reactContext, int32_t tag, const Experimental::ICompositionContext &context) {
|
|
90
|
+
auto view = winrt::Microsoft::ReactNative::Composition::implementation::ViewComponentView::Create(
|
|
91
|
+
context, tag, reactContext)
|
|
92
|
+
.as<winrt::Microsoft::ReactNative::Composition::ViewComponentView>();
|
|
93
|
+
initializer(view);
|
|
94
|
+
return view;
|
|
95
|
+
};
|
|
96
|
+
m_descriptorConstructorFactory = []() {
|
|
97
|
+
return &facebook::react::concreteComponentDescriptorConstructor<
|
|
98
|
+
::Microsoft::ReactNative::AbiViewComponentDescriptor>;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
void ReactCompositionViewComponentBuilder::SetContentIslandComponentViewInitializer(
|
|
103
|
+
const ComponentIslandComponentViewInitializer &initializer) noexcept {
|
|
104
|
+
m_fnCreateView = [initializer](
|
|
105
|
+
const IReactContext &reactContext, int32_t tag, const Experimental::ICompositionContext &context)
|
|
106
|
+
-> winrt::Microsoft::ReactNative::Composition::ContentIslandComponentView {
|
|
107
|
+
auto view = winrt::make<winrt::Microsoft::ReactNative::Composition::implementation::ContentIslandComponentView>(
|
|
108
|
+
context, tag, reactContext);
|
|
109
|
+
initializer(view);
|
|
110
|
+
return view;
|
|
111
|
+
};
|
|
112
|
+
m_descriptorConstructorFactory = []() {
|
|
113
|
+
return &facebook::react::concreteComponentDescriptorConstructor<
|
|
114
|
+
::Microsoft::ReactNative::AbiViewComponentDescriptor>;
|
|
115
|
+
};
|
|
52
116
|
}
|
|
53
117
|
|
|
54
|
-
void ReactCompositionViewComponentBuilder::SetCreateViewComponentView(
|
|
55
|
-
CompositionViewComponentViewFactory impl) noexcept {
|
|
56
|
-
m_createView = impl;
|
|
57
|
-
assert(!m_createComponentView); // Only SetCreateComponentView OR SetCreateViewComponentView should be called
|
|
58
|
-
}
|
|
59
118
|
// (Object handle, Microsoft.ReactNative.IComponentState state) => void
|
|
60
119
|
// void ReactCompositionViewComponentBuilder::SetStateUpdater(StateUpdater impl) noexcept {
|
|
61
120
|
// m_stateUpdater = impl;
|
|
@@ -93,22 +152,53 @@ void ReactCompositionViewComponentBuilder::SetLayoutHandler(
|
|
|
93
152
|
m_layoutHandler = impl;
|
|
94
153
|
}
|
|
95
154
|
|
|
155
|
+
void ReactCompositionViewComponentBuilder::SetCustomCommandHandler(HandleCommandDelegate impl) noexcept {
|
|
156
|
+
m_customCommandHandler = impl;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
void ReactCompositionViewComponentBuilder::SetFinalizeUpdateHandler(UpdateFinalizerDelegate impl) noexcept {
|
|
160
|
+
m_finalizeUpdateHandler = impl;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
void ReactCompositionViewComponentBuilder::SetUpdatePropsHandler(UpdatePropsDelegate impl) noexcept {
|
|
164
|
+
m_updatePropsHandler = impl;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
void ReactCompositionViewComponentBuilder::SetUpdateStateHandler(UpdateStateDelegate impl) noexcept {
|
|
168
|
+
m_updateStateHandler = impl;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
void ReactCompositionViewComponentBuilder::SetUpdateEventEmitterHandler(UpdateEventEmitterDelegate impl) noexcept {
|
|
172
|
+
m_updateEventEmitterHandler = impl;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
void ReactCompositionViewComponentBuilder::SetMountChildComponentViewHandler(
|
|
176
|
+
MountChildComponentViewDelegate impl) noexcept {
|
|
177
|
+
m_mountChildComponentViewHandler = impl;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
void ReactCompositionViewComponentBuilder::SetUnmountChildComponentViewHandler(
|
|
181
|
+
UnmountChildComponentViewDelegate impl) noexcept {
|
|
182
|
+
m_unmountChildComponentViewHandler = impl;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
void ReactCompositionViewComponentBuilder::SetCreateVisualHandler(CreateVisualDelegate impl) noexcept {
|
|
186
|
+
m_createVisualHandler = impl;
|
|
187
|
+
}
|
|
188
|
+
|
|
96
189
|
winrt::Microsoft::ReactNative::ComponentView ReactCompositionViewComponentBuilder::CreateView(
|
|
97
190
|
const IReactContext &reactContext,
|
|
98
191
|
int32_t tag,
|
|
99
192
|
const Experimental::ICompositionContext &context) noexcept {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
assert(m_createComponentView);
|
|
105
|
-
auto args = winrt::make<winrt::Microsoft::ReactNative::implementation::CreateComponentViewArgs>(reactContext, tag);
|
|
106
|
-
return m_createComponentView(args);
|
|
107
|
-
}
|
|
193
|
+
assert(m_fnCreateView);
|
|
194
|
+
auto view = m_fnCreateView(reactContext, tag, context);
|
|
195
|
+
InitializeComponentView(view);
|
|
196
|
+
return view;
|
|
108
197
|
}
|
|
109
198
|
|
|
110
|
-
|
|
111
|
-
|
|
199
|
+
facebook::react::ComponentDescriptorConstructor *ReactCompositionViewComponentBuilder::GetComponentDescriptorProvider()
|
|
200
|
+
const noexcept {
|
|
201
|
+
return m_descriptorConstructorFactory();
|
|
112
202
|
}
|
|
113
203
|
|
|
114
204
|
} // namespace winrt::Microsoft::ReactNative::Composition
|