react-native-windows 0.77.7 → 0.77.8
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 +5 -0
- 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,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
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from AndroidProgressBarNativeComponent 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(AndroidProgressBarProps)
|
|
22
|
+
struct AndroidProgressBarProps : winrt::implements<AndroidProgressBarProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
AndroidProgressBarProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<AndroidProgressBarProps>();
|
|
28
|
+
styleAttr = cloneFromProps->styleAttr;
|
|
29
|
+
typeAttr = cloneFromProps->typeAttr;
|
|
30
|
+
indeterminate = cloneFromProps->indeterminate;
|
|
31
|
+
progress = cloneFromProps->progress;
|
|
32
|
+
animating = cloneFromProps->animating;
|
|
33
|
+
color = cloneFromProps->color;
|
|
34
|
+
testID = cloneFromProps->testID;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void SetProp(uint32_t hash, winrt::hstring propName, winrt::Microsoft::ReactNative::IJSValueReader value) noexcept {
|
|
39
|
+
winrt::Microsoft::ReactNative::ReadProp(hash, propName, value, *this);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
REACT_FIELD(styleAttr)
|
|
43
|
+
std::optional<std::string> styleAttr;
|
|
44
|
+
|
|
45
|
+
REACT_FIELD(typeAttr)
|
|
46
|
+
std::optional<std::string> typeAttr;
|
|
47
|
+
|
|
48
|
+
REACT_FIELD(indeterminate)
|
|
49
|
+
bool indeterminate{};
|
|
50
|
+
|
|
51
|
+
REACT_FIELD(progress)
|
|
52
|
+
std::optional<double> progress{};
|
|
53
|
+
|
|
54
|
+
REACT_FIELD(animating)
|
|
55
|
+
bool animating{true};
|
|
56
|
+
|
|
57
|
+
REACT_FIELD(color)
|
|
58
|
+
winrt::Microsoft::ReactNative::Color color{nullptr};
|
|
59
|
+
|
|
60
|
+
REACT_FIELD(testID)
|
|
61
|
+
std::optional<std::string> testID;
|
|
62
|
+
|
|
63
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
struct AndroidProgressBarEventEmitter {
|
|
67
|
+
AndroidProgressBarEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
68
|
+
: m_eventEmitter(eventEmitter) {}
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
template<typename TUserData>
|
|
75
|
+
struct BaseAndroidProgressBar {
|
|
76
|
+
|
|
77
|
+
virtual void UpdateProps(
|
|
78
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
79
|
+
const winrt::com_ptr<AndroidProgressBarProps> &newProps,
|
|
80
|
+
const winrt::com_ptr<AndroidProgressBarProps> &/*oldProps*/) noexcept {
|
|
81
|
+
m_props = newProps;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
85
|
+
virtual void UpdateLayoutMetrics(
|
|
86
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
87
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
88
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// UpdateState will only be called if this method is overridden
|
|
92
|
+
virtual void UpdateState(
|
|
93
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
94
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<AndroidProgressBarEventEmitter> &eventEmitter) noexcept {
|
|
98
|
+
m_eventEmitter = eventEmitter;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
102
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
103
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
107
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
108
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Initialize will only be called if this method is overridden
|
|
112
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// CreateVisual will only be called if this method is overridden
|
|
116
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
117
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
121
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
122
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
const std::shared_ptr<AndroidProgressBarEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
128
|
+
const winrt::com_ptr<AndroidProgressBarProps>& Props() const { return m_props; }
|
|
129
|
+
|
|
130
|
+
private:
|
|
131
|
+
winrt::com_ptr<AndroidProgressBarProps> m_props;
|
|
132
|
+
std::shared_ptr<AndroidProgressBarEventEmitter> m_eventEmitter;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
template <typename TUserData>
|
|
136
|
+
void RegisterAndroidProgressBarNativeComponent(
|
|
137
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
138
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
139
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
140
|
+
L"AndroidProgressBar", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
141
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
142
|
+
|
|
143
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
144
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
145
|
+
return winrt::make<AndroidProgressBarProps>(props, cloneFrom);
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
149
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
150
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
151
|
+
auto userData = view.UserData().as<TUserData>();
|
|
152
|
+
userData->UpdateProps(view, newProps ? newProps.as<AndroidProgressBarProps>() : nullptr, oldProps ? oldProps.as<AndroidProgressBarProps>() : nullptr);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
156
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
157
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
158
|
+
auto userData = view.UserData().as<TUserData>();
|
|
159
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
163
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
164
|
+
auto userData = view.UserData().as<TUserData>();
|
|
165
|
+
userData->UpdateEventEmitter(std::make_shared<AndroidProgressBarEventEmitter>(eventEmitter));
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidProgressBar<TUserData>::FinalizeUpdate) {
|
|
169
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
170
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
171
|
+
auto userData = view.UserData().as<TUserData>();
|
|
172
|
+
userData->FinalizeUpdate(view, mask);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if constexpr (&TUserData::UpdateState != &BaseAndroidProgressBar<TUserData>::UpdateState) {
|
|
177
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
178
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
179
|
+
auto userData = view.UserData().as<TUserData>();
|
|
180
|
+
userData->UpdateState(view, newState);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseAndroidProgressBar<TUserData>::MountChildComponentView) {
|
|
185
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
186
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
187
|
+
auto userData = view.UserData().as<TUserData>();
|
|
188
|
+
return userData->MountChildComponentView(view, args);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidProgressBar<TUserData>::UnmountChildComponentView) {
|
|
193
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
194
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
195
|
+
auto userData = view.UserData().as<TUserData>();
|
|
196
|
+
return userData->UnmountChildComponentView(view, args);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
201
|
+
auto userData = winrt::make_self<TUserData>();
|
|
202
|
+
if constexpr (&TUserData::Initialize != &BaseAndroidProgressBar<TUserData>::Initialize) {
|
|
203
|
+
userData->Initialize(view);
|
|
204
|
+
}
|
|
205
|
+
view.UserData(*userData);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
if constexpr (&TUserData::CreateVisual != &BaseAndroidProgressBar<TUserData>::CreateVisual) {
|
|
209
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
210
|
+
auto userData = view.UserData().as<TUserData>();
|
|
211
|
+
return userData->CreateVisual(view);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Allow app to further customize the builder
|
|
216
|
+
if (builderCallback) {
|
|
217
|
+
builderCallback(compBuilder);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
223
|
+
|
|
224
|
+
#endif // #ifdef RNW_NEW_ARCH
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* This file is auto-generated from AndroidSwipeRefreshLayoutNativeComponent 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(AndroidSwipeRefreshLayoutProps)
|
|
22
|
+
struct AndroidSwipeRefreshLayoutProps : winrt::implements<AndroidSwipeRefreshLayoutProps, winrt::Microsoft::ReactNative::IComponentProps> {
|
|
23
|
+
AndroidSwipeRefreshLayoutProps(winrt::Microsoft::ReactNative::ViewProps props, const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom)
|
|
24
|
+
: ViewProps(props)
|
|
25
|
+
{
|
|
26
|
+
if (cloneFrom) {
|
|
27
|
+
auto cloneFromProps = cloneFrom.as<AndroidSwipeRefreshLayoutProps>();
|
|
28
|
+
enabled = cloneFromProps->enabled;
|
|
29
|
+
colors = cloneFromProps->colors;
|
|
30
|
+
progressBackgroundColor = cloneFromProps->progressBackgroundColor;
|
|
31
|
+
size = cloneFromProps->size;
|
|
32
|
+
progressViewOffset = cloneFromProps->progressViewOffset;
|
|
33
|
+
refreshing = cloneFromProps->refreshing;
|
|
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(enabled)
|
|
42
|
+
bool enabled{true};
|
|
43
|
+
|
|
44
|
+
REACT_FIELD(colors)
|
|
45
|
+
std::optional<std::vector<winrt::Microsoft::ReactNative::Color>> colors;
|
|
46
|
+
|
|
47
|
+
REACT_FIELD(progressBackgroundColor)
|
|
48
|
+
winrt::Microsoft::ReactNative::Color progressBackgroundColor{nullptr};
|
|
49
|
+
|
|
50
|
+
REACT_FIELD(size)
|
|
51
|
+
std::optional<std::string> size;
|
|
52
|
+
|
|
53
|
+
REACT_FIELD(progressViewOffset)
|
|
54
|
+
std::optional<float> progressViewOffset{};
|
|
55
|
+
|
|
56
|
+
REACT_FIELD(refreshing)
|
|
57
|
+
bool refreshing{};
|
|
58
|
+
|
|
59
|
+
const winrt::Microsoft::ReactNative::ViewProps ViewProps;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
REACT_STRUCT(AndroidSwipeRefreshLayout_OnRefresh)
|
|
63
|
+
struct AndroidSwipeRefreshLayout_OnRefresh {
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
struct AndroidSwipeRefreshLayoutEventEmitter {
|
|
67
|
+
AndroidSwipeRefreshLayoutEventEmitter(const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
|
|
68
|
+
: m_eventEmitter(eventEmitter) {}
|
|
69
|
+
|
|
70
|
+
using OnRefresh = AndroidSwipeRefreshLayout_OnRefresh;
|
|
71
|
+
|
|
72
|
+
void onRefresh(OnRefresh &value) const {
|
|
73
|
+
m_eventEmitter.DispatchEvent(L"refresh", [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
|
|
74
|
+
winrt::Microsoft::ReactNative::WriteValue(writer, value);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private:
|
|
79
|
+
winrt::Microsoft::ReactNative::EventEmitter m_eventEmitter{nullptr};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
template<typename TUserData>
|
|
83
|
+
struct BaseAndroidSwipeRefreshLayout {
|
|
84
|
+
|
|
85
|
+
virtual void UpdateProps(
|
|
86
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
87
|
+
const winrt::com_ptr<AndroidSwipeRefreshLayoutProps> &newProps,
|
|
88
|
+
const winrt::com_ptr<AndroidSwipeRefreshLayoutProps> &/*oldProps*/) noexcept {
|
|
89
|
+
m_props = newProps;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// UpdateLayoutMetrics will only be called if this method is overridden
|
|
93
|
+
virtual void UpdateLayoutMetrics(
|
|
94
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
95
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*newLayoutMetrics*/,
|
|
96
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &/*oldLayoutMetrics*/) noexcept {
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// UpdateState will only be called if this method is overridden
|
|
100
|
+
virtual void UpdateState(
|
|
101
|
+
const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
102
|
+
const winrt::Microsoft::ReactNative::IComponentState &/*newState*/) noexcept {
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
virtual void UpdateEventEmitter(const std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter> &eventEmitter) noexcept {
|
|
106
|
+
m_eventEmitter = eventEmitter;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// MountChildComponentView will only be called if this method is overridden
|
|
110
|
+
virtual void MountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
111
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &/*args*/) noexcept {
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// UnmountChildComponentView will only be called if this method is overridden
|
|
115
|
+
virtual void UnmountChildComponentView(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
116
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &/*args*/) noexcept {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Initialize will only be called if this method is overridden
|
|
120
|
+
virtual void Initialize(const winrt::Microsoft::ReactNative::ComponentView &/*view*/) noexcept {
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// CreateVisual will only be called if this method is overridden
|
|
124
|
+
virtual winrt::Microsoft::UI::Composition::Visual CreateVisual(const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
125
|
+
return view.as<winrt::Microsoft::ReactNative::Composition::ComponentView>().Compositor().CreateSpriteVisual();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// FinalizeUpdate will only be called if this method is overridden
|
|
129
|
+
virtual void FinalizeUpdate(const winrt::Microsoft::ReactNative::ComponentView &/*view*/,
|
|
130
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask /*mask*/) noexcept {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// You must provide an implementation of this method to handle the "setNativeRefreshing" command
|
|
134
|
+
virtual void HandleSetNativeRefreshingCommand(bool value) noexcept = 0;
|
|
135
|
+
|
|
136
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::ComponentView &view, const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
137
|
+
auto userData = view.UserData().as<TUserData>();
|
|
138
|
+
auto commandName = args.CommandName();
|
|
139
|
+
if (commandName == L"setNativeRefreshing") {
|
|
140
|
+
bool value;
|
|
141
|
+
winrt::Microsoft::ReactNative::ReadArgs(args.CommandArgs(), value);
|
|
142
|
+
userData->HandleSetNativeRefreshingCommand(value);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter>& EventEmitter() const { return m_eventEmitter; }
|
|
148
|
+
const winrt::com_ptr<AndroidSwipeRefreshLayoutProps>& Props() const { return m_props; }
|
|
149
|
+
|
|
150
|
+
private:
|
|
151
|
+
winrt::com_ptr<AndroidSwipeRefreshLayoutProps> m_props;
|
|
152
|
+
std::shared_ptr<AndroidSwipeRefreshLayoutEventEmitter> m_eventEmitter;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
template <typename TUserData>
|
|
156
|
+
void RegisterAndroidSwipeRefreshLayoutNativeComponent(
|
|
157
|
+
winrt::Microsoft::ReactNative::IReactPackageBuilder const &packageBuilder,
|
|
158
|
+
std::function<void(const winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder&)> builderCallback) noexcept {
|
|
159
|
+
packageBuilder.as<winrt::Microsoft::ReactNative::IReactPackageBuilderFabric>().AddViewComponent(
|
|
160
|
+
L"AndroidSwipeRefreshLayout", [builderCallback](winrt::Microsoft::ReactNative::IReactViewComponentBuilder const &builder) noexcept {
|
|
161
|
+
auto compBuilder = builder.as<winrt::Microsoft::ReactNative::Composition::IReactCompositionViewComponentBuilder>();
|
|
162
|
+
|
|
163
|
+
builder.SetCreateProps([](winrt::Microsoft::ReactNative::ViewProps props,
|
|
164
|
+
const winrt::Microsoft::ReactNative::IComponentProps& cloneFrom) noexcept {
|
|
165
|
+
return winrt::make<AndroidSwipeRefreshLayoutProps>(props, cloneFrom);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
builder.SetUpdatePropsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
169
|
+
const winrt::Microsoft::ReactNative::IComponentProps &newProps,
|
|
170
|
+
const winrt::Microsoft::ReactNative::IComponentProps &oldProps) noexcept {
|
|
171
|
+
auto userData = view.UserData().as<TUserData>();
|
|
172
|
+
userData->UpdateProps(view, newProps ? newProps.as<AndroidSwipeRefreshLayoutProps>() : nullptr, oldProps ? oldProps.as<AndroidSwipeRefreshLayoutProps>() : nullptr);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
compBuilder.SetUpdateLayoutMetricsHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
176
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &newLayoutMetrics,
|
|
177
|
+
const winrt::Microsoft::ReactNative::LayoutMetrics &oldLayoutMetrics) noexcept {
|
|
178
|
+
auto userData = view.UserData().as<TUserData>();
|
|
179
|
+
userData->UpdateLayoutMetrics(view, newLayoutMetrics, oldLayoutMetrics);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
builder.SetUpdateEventEmitterHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
183
|
+
const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter) noexcept {
|
|
184
|
+
auto userData = view.UserData().as<TUserData>();
|
|
185
|
+
userData->UpdateEventEmitter(std::make_shared<AndroidSwipeRefreshLayoutEventEmitter>(eventEmitter));
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if constexpr (&TUserData::FinalizeUpdate != &BaseAndroidSwipeRefreshLayout<TUserData>::FinalizeUpdate) {
|
|
189
|
+
builder.SetFinalizeUpdateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
190
|
+
winrt::Microsoft::ReactNative::ComponentViewUpdateMask mask) noexcept {
|
|
191
|
+
auto userData = view.UserData().as<TUserData>();
|
|
192
|
+
userData->FinalizeUpdate(view, mask);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if constexpr (&TUserData::UpdateState != &BaseAndroidSwipeRefreshLayout<TUserData>::UpdateState) {
|
|
197
|
+
builder.SetUpdateStateHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
198
|
+
const winrt::Microsoft::ReactNative::IComponentState &newState) noexcept {
|
|
199
|
+
auto userData = view.UserData().as<TUserData>();
|
|
200
|
+
userData->UpdateState(view, newState);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
builder.SetCustomCommandHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
205
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs& args) noexcept {
|
|
206
|
+
auto userData = view.UserData().as<TUserData>();
|
|
207
|
+
userData->HandleCommand(view, args);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
if constexpr (&TUserData::MountChildComponentView != &BaseAndroidSwipeRefreshLayout<TUserData>::MountChildComponentView) {
|
|
211
|
+
builder.SetMountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
212
|
+
const winrt::Microsoft::ReactNative::MountChildComponentViewArgs &args) noexcept {
|
|
213
|
+
auto userData = view.UserData().as<TUserData>();
|
|
214
|
+
return userData->MountChildComponentView(view, args);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if constexpr (&TUserData::UnmountChildComponentView != &BaseAndroidSwipeRefreshLayout<TUserData>::UnmountChildComponentView) {
|
|
219
|
+
builder.SetUnmountChildComponentViewHandler([](const winrt::Microsoft::ReactNative::ComponentView &view,
|
|
220
|
+
const winrt::Microsoft::ReactNative::UnmountChildComponentViewArgs &args) noexcept {
|
|
221
|
+
auto userData = view.UserData().as<TUserData>();
|
|
222
|
+
return userData->UnmountChildComponentView(view, args);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
compBuilder.SetViewComponentViewInitializer([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
227
|
+
auto userData = winrt::make_self<TUserData>();
|
|
228
|
+
if constexpr (&TUserData::Initialize != &BaseAndroidSwipeRefreshLayout<TUserData>::Initialize) {
|
|
229
|
+
userData->Initialize(view);
|
|
230
|
+
}
|
|
231
|
+
view.UserData(*userData);
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
if constexpr (&TUserData::CreateVisual != &BaseAndroidSwipeRefreshLayout<TUserData>::CreateVisual) {
|
|
235
|
+
compBuilder.SetCreateVisualHandler([](const winrt::Microsoft::ReactNative::ComponentView &view) noexcept {
|
|
236
|
+
auto userData = view.UserData().as<TUserData>();
|
|
237
|
+
return userData->CreateVisual(view);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Allow app to further customize the builder
|
|
242
|
+
if (builderCallback) {
|
|
243
|
+
builderCallback(compBuilder);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
} // namespace Microsoft::ReactNativeSpecs
|
|
249
|
+
|
|
250
|
+
#endif // #ifdef RNW_NEW_ARCH
|