react-native-windows 0.77.7 → 0.77.9
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/Libraries/Modal/Modal.windows.js +4 -1
- package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.cpp +97 -0
- package/Microsoft.ReactNative/Fabric/AbiPortalShadowNode.h +53 -0
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.h +160 -17
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +0 -2
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -32
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +25 -20
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +313 -319
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +78 -0
- package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +22 -0
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +73 -19
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -23
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +15 -1
- package/Microsoft.ReactNative/ReactNativeHost.cpp +5 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/Shared/Networking/WinRTWebSocketResource.cpp +82 -96
- package/Shared/Networking/WinRTWebSocketResource.h +91 -7
- package/Shared/Shared.vcxitems +6 -5
- package/Shared/Shared.vcxitems.filters +3 -4
- package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
- package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
- package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
- package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
- package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
- package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
- package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
- package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
- package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
- package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
- package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
- package/codegen/react/components/rnwcore/Switch.g.h +263 -0
- package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
- package/just-task.js +1 -1
- package/package.json +3 -3
- package/Microsoft.ReactNative/Fabric/AbiViewComponentDescriptor.cpp +0 -191
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from AndroidDrawerLayoutNativeComponent spec file in flow / TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
// clang-format off
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <NativeModules.h>
|
|
9
|
+
|
|
10
|
+
#ifdef RNW_NEW_ARCH
|
|
11
|
+
#include <JSValueComposition.h>
|
|
12
|
+
|
|
13
|
+
#include <winrt/Microsoft.ReactNative.Composition.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Composition.h>
|
|
15
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
16
|
+
|
|
17
|
+
#ifdef RNW_NEW_ARCH
|
|
18
|
+
|
|
19
|
+
namespace Microsoft::ReactNativeSpecs {
|
|
20
|
+
|
|
21
|
+
REACT_STRUCT(AndroidDrawerLayoutProps)
|
|
22
|
+
struct AndroidDrawerLayoutProps : winrt::implements<AndroidDrawerLayoutProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
AndroidDrawerLayoutProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<AndroidDrawerLayoutProps>();
|
|
28
|
+
keyboardDismissMode = cloneFromProps->keyboardDismissMode;
|
|
29
|
+
drawerBackgroundColor = cloneFromProps->drawerBackgroundColor;
|
|
30
|
+
drawerPosition = cloneFromProps->drawerPosition;
|
|
31
|
+
drawerWidth = cloneFromProps->drawerWidth;
|
|
32
|
+
drawerLockMode = cloneFromProps->drawerLockMode;
|
|
33
|
+
statusBarBackgroundColor = cloneFromProps->statusBarBackgroundColor;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
|
38
|
+
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
REACT_FIELD(keyboardDismissMode)
|
|
42
|
+
std::optional<std::string> keyboardDismissMode;
|
|
43
|
+
|
|
44
|
+
REACT_FIELD(drawerBackgroundColor)
|
|
45
|
+
winrt::Microsoft::ReactNative::Color drawerBackgroundColor{nullptr};
|
|
46
|
+
|
|
47
|
+
REACT_FIELD(drawerPosition)
|
|
48
|
+
std::optional<std::string> drawerPosition;
|
|
49
|
+
|
|
50
|
+
REACT_FIELD(drawerWidth)
|
|
51
|
+
std::optional<float> drawerWidth{};
|
|
52
|
+
|
|
53
|
+
REACT_FIELD(drawerLockMode)
|
|
54
|
+
std::optional<std::string> drawerLockMode;
|
|
55
|
+
|
|
56
|
+
REACT_FIELD(statusBarBackgroundColor)
|
|
57
|
+
winrt::Microsoft::ReactNative::Color statusBarBackgroundColor{nullptr};
|
|
58
|
+
|
|
59
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
REACT_STRUCT(AndroidDrawerLayout_OnDrawerSlide)
|
|
63
|
+
struct AndroidDrawerLayout_OnDrawerSlide {
|
|
64
|
+
REACT_FIELD(offset)
|
|
65
|
+
float offset{};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
REACT_STRUCT(AndroidDrawerLayout_OnDrawerStateChanged)
|
|
69
|
+
struct AndroidDrawerLayout_OnDrawerStateChanged {
|
|
70
|
+
REACT_FIELD(drawerState)
|
|
71
|
+
int32_t drawerState{};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
REACT_STRUCT(AndroidDrawerLayout_OnDrawerOpen)
|
|
75
|
+
struct AndroidDrawerLayout_OnDrawerOpen {
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
REACT_STRUCT(AndroidDrawerLayout_OnDrawerClose)
|
|
79
|
+
struct AndroidDrawerLayout_OnDrawerClose {
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
struct AndroidDrawerLayoutEventEmitter {
|
|
83
|
+
AndroidDrawerLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
84
|
+
: m_eventEmitter(eventEmitter) {}
|
|
85
|
+
|
|
86
|
+
using OnDrawerSlide = AndroidDrawerLayout_OnDrawerSlide;
|
|
87
|
+
using OnDrawerStateChanged = AndroidDrawerLayout_OnDrawerStateChanged;
|
|
88
|
+
using OnDrawerOpen = AndroidDrawerLayout_OnDrawerOpen;
|
|
89
|
+
using OnDrawerClose = AndroidDrawerLayout_OnDrawerClose;
|
|
90
|
+
|
|
91
|
+
void onDrawerSlide(OnDrawerSlide &value) const {
|
|
92
|
+
m_eventEmitter.DispatchEvent(L"drawerSlide", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
93
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void onDrawerStateChanged(OnDrawerStateChanged &value) const {
|
|
98
|
+
m_eventEmitter.DispatchEvent(L"drawerStateChanged", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
99
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
void onDrawerOpen(OnDrawerOpen &value) const {
|
|
104
|
+
m_eventEmitter.DispatchEvent(L"drawerOpen", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
105
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
void onDrawerClose(OnDrawerClose &value) const {
|
|
110
|
+
m_eventEmitter.DispatchEvent(L"drawerClose", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
111
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private:
|
|
116
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
template<typename TUserData>
|
|
120
|
+
struct BaseAndroidDrawerLayout {
|
|
121
|
+
|
|
122
|
+
virtual void UpdateProps(
|
|
123
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
124
|
+
const winrt::com_ptr<AndroidDrawerLayoutProps> &newProps,
|
|
125
|
+
const winrt::com_ptr<AndroidDrawerLayoutProps> &/*oldProps*/) noexcept {
|
|
126
|
+
m_props = newProps;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
130
|
+
virtual void UpdateLayoutMetrics(
|
|
131
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
132
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
133
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// UpdateState will only be called if this method is overridden
|
|
137
|
+
virtual void UpdateState(
|
|
138
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
139
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<AndroidDrawerLayoutEventEmitter> &eventEmitter) noexcept {
|
|
143
|
+
m_eventEmitter = eventEmitter;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
147
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
148
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
152
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
153
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Initialize will only be called if this method is overridden
|
|
157
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// CreateVisual will only be called if this method is overridden
|
|
161
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
162
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
166
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
167
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// You must provide an implementation of this method to handle the "openDrawer" command
|
|
171
|
+
virtual void HandleOpenDrawerCommand() noexcept = 0;
|
|
172
|
+
|
|
173
|
+
// You must provide an implementation of this method to handle the "closeDrawer" command
|
|
174
|
+
virtual void HandleCloseDrawerCommand() noexcept = 0;
|
|
175
|
+
|
|
176
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::ComponentView &view, const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
177
|
+
auto userData = view.UserData().as<TUserData>();
|
|
178
|
+
auto commandName = args.CommandName();
|
|
179
|
+
if (commandName == L"openDrawer") {
|
|
180
|
+
|
|
181
|
+
userData->HandleOpenDrawerCommand();
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (commandName == L"closeDrawer") {
|
|
186
|
+
|
|
187
|
+
userData->HandleCloseDrawerCommand();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const std::shared_ptr<AndroidDrawerLayoutEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
193
|
+
const winrt::com_ptr<AndroidDrawerLayoutProps>& Props() const { return m_props; }
|
|
194
|
+
|
|
195
|
+
private:
|
|
196
|
+
winrt::com_ptr<AndroidDrawerLayoutProps> m_props;
|
|
197
|
+
std::shared_ptr<AndroidDrawerLayoutEventEmitter> m_eventEmitter;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
template <typename TUserData>
|
|
201
|
+
void RegisterAndroidDrawerLayoutNativeComponent(
|
|
202
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
203
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
204
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
205
|
+
L"AndroidDrawerLayout", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
206
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
207
|
+
|
|
208
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
209
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
210
|
+
return winrt::make<AndroidDrawerLayoutProps>(props, cloneFrom);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
214
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
215
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
216
|
+
auto userData = view.UserData().as<TUserData>();
|
|
217
|
+
userData->UpdateProps(view, newProps ? newProps.as<AndroidDrawerLayoutProps>() : nullptr, oldProps ? oldProps.as<AndroidDrawerLayoutProps>() : nullptr);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
221
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
222
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
223
|
+
auto userData = view.UserData().as<TUserData>();
|
|
224
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
228
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
229
|
+
auto userData = view.UserData().as<TUserData>();
|
|
230
|
+
userData->UpdateEventEmitter(std::make_shared<AndroidDrawerLayoutEventEmitter>(eventEmitter));
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidDrawerLayout<TUserData>::FinalizeUpdate) {
|
|
234
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
235
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
236
|
+
auto userData = view.UserData().as<TUserData>();
|
|
237
|
+
userData->FinalizeUpdate(view, mask);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if constexpr (&TUserData::UpdateState != &BaseAndroidDrawerLayout<TUserData>::UpdateState) {
|
|
242
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
243
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
244
|
+
auto userData = view.UserData().as<TUserData>();
|
|
245
|
+
userData->UpdateState(view, newState);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
builder.SetCustomCommandHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
250
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
251
|
+
auto userData = view.UserData().as<TUserData>();
|
|
252
|
+
userData->HandleCommand(view, args);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseAndroidDrawerLayout<TUserData>::MountChildComponentView) {
|
|
256
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
257
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
258
|
+
auto userData = view.UserData().as<TUserData>();
|
|
259
|
+
return userData->MountChildComponentView(view, args);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidDrawerLayout<TUserData>::UnmountChildComponentView) {
|
|
264
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
265
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
266
|
+
auto userData = view.UserData().as<TUserData>();
|
|
267
|
+
return userData->UnmountChildComponentView(view, args);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
272
|
+
auto userData = winrt::make_self<TUserData>();
|
|
273
|
+
if constexpr (&TUserData::Initialize != &BaseAndroidDrawerLayout<TUserData>::Initialize) {
|
|
274
|
+
userData->Initialize(view);
|
|
275
|
+
}
|
|
276
|
+
view.UserData(*userData);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
if constexpr (&TUserData::CreateVisual != &BaseAndroidDrawerLayout<TUserData>::CreateVisual) {
|
|
280
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
281
|
+
auto userData = view.UserData().as<TUserData>();
|
|
282
|
+
return userData->CreateVisual(view);
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Allow app to further customize the builder
|
|
287
|
+
if (builderCallback) {
|
|
288
|
+
builderCallback(compBuilder);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
294
|
+
|
|
295
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from AndroidHorizontalScrollContentViewNativeComponent spec file in flow / TypeScript.
|
|
4
|
+
*/
|
|
5
|
+
// clang-format off
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include <NativeModules.h>
|
|
9
|
+
|
|
10
|
+
#ifdef RNW_NEW_ARCH
|
|
11
|
+
#include <JSValueComposition.h>
|
|
12
|
+
|
|
13
|
+
#include <winrt/Microsoft.ReactNative.Composition.h>
|
|
14
|
+
#include <winrt/Microsoft.UI.Composition.h>
|
|
15
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
16
|
+
|
|
17
|
+
#ifdef RNW_NEW_ARCH
|
|
18
|
+
|
|
19
|
+
namespace Microsoft::ReactNativeSpecs {
|
|
20
|
+
|
|
21
|
+
REACT_STRUCT(AndroidHorizontalScrollContentViewProps)
|
|
22
|
+
struct AndroidHorizontalScrollContentViewProps : winrt::implements<AndroidHorizontalScrollContentViewProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
AndroidHorizontalScrollContentViewProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<AndroidHorizontalScrollContentViewProps>();
|
|
28
|
+
removeClippedSubviews = cloneFromProps->removeClippedSubviews;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
|
33
|
+
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
REACT_FIELD(removeClippedSubviews)
|
|
37
|
+
std::optional<bool> removeClippedSubviews{};
|
|
38
|
+
|
|
39
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
struct AndroidHorizontalScrollContentViewEventEmitter {
|
|
43
|
+
AndroidHorizontalScrollContentViewEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
44
|
+
: m_eventEmitter(eventEmitter) {}
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
template<typename TUserData>
|
|
51
|
+
struct BaseAndroidHorizontalScrollContentView {
|
|
52
|
+
|
|
53
|
+
virtual void UpdateProps(
|
|
54
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
55
|
+
const winrt::com_ptr<AndroidHorizontalScrollContentViewProps> &newProps,
|
|
56
|
+
const winrt::com_ptr<AndroidHorizontalScrollContentViewProps> &/*oldProps*/) noexcept {
|
|
57
|
+
m_props = newProps;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
61
|
+
virtual void UpdateLayoutMetrics(
|
|
62
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
63
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
64
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// UpdateState will only be called if this method is overridden
|
|
68
|
+
virtual void UpdateState(
|
|
69
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
70
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter> &eventEmitter) noexcept {
|
|
74
|
+
m_eventEmitter = eventEmitter;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
78
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
79
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
83
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
84
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Initialize will only be called if this method is overridden
|
|
88
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// CreateVisual will only be called if this method is overridden
|
|
92
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
93
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
97
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
98
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
const std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
104
|
+
const winrt::com_ptr<AndroidHorizontalScrollContentViewProps>& Props() const { return m_props; }
|
|
105
|
+
|
|
106
|
+
private:
|
|
107
|
+
winrt::com_ptr<AndroidHorizontalScrollContentViewProps> m_props;
|
|
108
|
+
std::shared_ptr<AndroidHorizontalScrollContentViewEventEmitter> m_eventEmitter;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
template <typename TUserData>
|
|
112
|
+
void RegisterAndroidHorizontalScrollContentViewNativeComponent(
|
|
113
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
114
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
115
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
116
|
+
L"AndroidHorizontalScrollContentView", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
117
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
118
|
+
|
|
119
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
120
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
121
|
+
return winrt::make<AndroidHorizontalScrollContentViewProps>(props, cloneFrom);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
125
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
126
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
127
|
+
auto userData = view.UserData().as<TUserData>();
|
|
128
|
+
userData->UpdateProps(view, newProps ? newProps.as<AndroidHorizontalScrollContentViewProps>() : nullptr, oldProps ? oldProps.as<AndroidHorizontalScrollContentViewProps>() : nullptr);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
132
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
133
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
134
|
+
auto userData = view.UserData().as<TUserData>();
|
|
135
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
139
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
140
|
+
auto userData = view.UserData().as<TUserData>();
|
|
141
|
+
userData->UpdateEventEmitter(std::make_shared<AndroidHorizontalScrollContentViewEventEmitter>(eventEmitter));
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidHorizontalScrollContentView<TUserData>::FinalizeUpdate) {
|
|
145
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
146
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
147
|
+
auto userData = view.UserData().as<TUserData>();
|
|
148
|
+
userData->FinalizeUpdate(view, mask);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if constexpr (&TUserData::UpdateState != &BaseAndroidHorizontalScrollContentView<TUserData>::UpdateState) {
|
|
153
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
154
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
155
|
+
auto userData = view.UserData().as<TUserData>();
|
|
156
|
+
userData->UpdateState(view, newState);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseAndroidHorizontalScrollContentView<TUserData>::MountChildComponentView) {
|
|
161
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
162
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
163
|
+
auto userData = view.UserData().as<TUserData>();
|
|
164
|
+
return userData->MountChildComponentView(view, args);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidHorizontalScrollContentView<TUserData>::UnmountChildComponentView) {
|
|
169
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
170
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
171
|
+
auto userData = view.UserData().as<TUserData>();
|
|
172
|
+
return userData->UnmountChildComponentView(view, args);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
177
|
+
auto userData = winrt::make_self<TUserData>();
|
|
178
|
+
if constexpr (&TUserData::Initialize != &BaseAndroidHorizontalScrollContentView<TUserData>::Initialize) {
|
|
179
|
+
userData->Initialize(view);
|
|
180
|
+
}
|
|
181
|
+
view.UserData(*userData);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
if constexpr (&TUserData::CreateVisual != &BaseAndroidHorizontalScrollContentView<TUserData>::CreateVisual) {
|
|
185
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
186
|
+
auto userData = view.UserData().as<TUserData>();
|
|
187
|
+
return userData->CreateVisual(view);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Allow app to further customize the builder
|
|
192
|
+
if (builderCallback) {
|
|
193
|
+
builderCallback(compBuilder);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
199
|
+
|
|
200
|
+
#endif // #ifdef RNW_NEW_ARCH
|