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