react-native-windows 0.74.20 → 0.74.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Microsoft.ReactNative/ComponentView.idl +44 -32
- package/Microsoft.ReactNative/Composition.Input.idl +3 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
- package/Microsoft.ReactNative/CompositionSwitcher.idl +3 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.cpp +21 -0
- package/Microsoft.ReactNative/Fabric/AbiEventEmitter.h +23 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.cpp +7 -0
- package/Microsoft.ReactNative/Fabric/AbiShadowNode.h +3 -0
- package/Microsoft.ReactNative/Fabric/ComponentView.cpp +334 -65
- package/Microsoft.ReactNative/Fabric/ComponentView.h +162 -38
- package/Microsoft.ReactNative/Fabric/Composition/ActivityIndicatorComponentView.cpp +2 -2
- package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +29 -7
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +23 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +44 -13
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +118 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +12 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionHwndHost.cpp +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +129 -106
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +31 -54
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +133 -0
- package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +61 -0
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.cpp +9 -8
- package/Microsoft.ReactNative/Fabric/Composition/DebuggingOverlayComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.cpp +20 -6
- package/Microsoft.ReactNative/Fabric/Composition/FocusManager.h +13 -6
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +3 -5
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +1 -6
- package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +0 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +108 -18
- package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +33 -5
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +137 -56
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +21 -4
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +45 -10
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +9 -2
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +209 -189
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +2 -5
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +22 -10
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +4 -5
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +1 -1
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +115 -168
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +11 -14
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +14 -11
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +4 -4
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -13
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h +0 -3
- package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +12 -4
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +338 -0
- package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +66 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +56 -4
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +7 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -4
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.h +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +40 -9
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +4 -0
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +25 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +4 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +1 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp +9 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +64 -4
- package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
- package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +9 -0
- package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.cpp +104 -0
- package/Microsoft.ReactNative/Modules/SampleTurboModule.h +78 -0
- package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.cpp +0 -7
- package/Microsoft.ReactNative/ReactHost/MsoReactContext.h +0 -5
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +17 -1
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.cpp +59 -0
- package/Microsoft.ReactNative/ReactInstanceSettingsBuilder.h +23 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.cpp +179 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.h +35 -0
- package/Microsoft.ReactNative/ReactNativeAppBuilder.idl +69 -0
- package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.cpp +82 -0
- package/Microsoft.ReactNative/ReactNativeWin32App.h +38 -0
- package/Microsoft.ReactNative/Timer.idl +1 -1
- package/Microsoft.ReactNative/packages.lock.json +0 -10
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Shared.vcxitems +43 -0
- package/Shared/Shared.vcxitems.filters +3 -0
- package/Shared/TurboModuleManager.cpp +0 -3
- package/just-task.js +1 -1
- package/package.json +3 -3
- package/templates/cpp-app/windows/MyApp/MyApp.cpp +1 -0
|
@@ -72,9 +72,10 @@ HRESULT UiaNavigateHelper(
|
|
|
72
72
|
auto parentCV = view.Parent().as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
|
|
73
73
|
if (parentCV != nullptr) {
|
|
74
74
|
auto children = parentCV->Children();
|
|
75
|
-
for (auto
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
for (auto i = children.Size() - 1; i > 0; i--) {
|
|
76
|
+
auto child = children.GetAt(i);
|
|
77
|
+
if (child == view) {
|
|
78
|
+
uiaProvider = children.GetAt(i - 1)
|
|
78
79
|
.as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>()
|
|
79
80
|
->EnsureUiaProvider();
|
|
80
81
|
break;
|
|
@@ -121,7 +122,9 @@ HRESULT UiaSetFocusHelper(::Microsoft::ReactNative::ReactTaggedView &view) noexc
|
|
|
121
122
|
if (rootCV == nullptr)
|
|
122
123
|
return UIA_E_ELEMENTNOTAVAILABLE;
|
|
123
124
|
|
|
124
|
-
return rootCV->TrySetFocusedComponent(strongView)
|
|
125
|
+
return rootCV->TrySetFocusedComponent(strongView, winrt::Microsoft::ReactNative::FocusNavigationDirection::None)
|
|
126
|
+
? S_OK
|
|
127
|
+
: E_FAIL;
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
bool WasUiaPropertyAdvised(winrt::com_ptr<IRawElementProviderSimple> &providerSimple, PROPERTYID propId) noexcept {
|
|
@@ -162,4 +165,53 @@ void UpdateUiaProperty(
|
|
|
162
165
|
spProviderSimple.get(), propId, CComVariant(oldValue.c_str()), CComVariant(newValue.c_str()));
|
|
163
166
|
}
|
|
164
167
|
|
|
168
|
+
long GetLiveSetting(const std::string &liveRegion) noexcept {
|
|
169
|
+
if (liveRegion == "polite") {
|
|
170
|
+
return LiveSetting::Polite;
|
|
171
|
+
} else if (liveRegion == "assertive") {
|
|
172
|
+
return LiveSetting::Assertive;
|
|
173
|
+
}
|
|
174
|
+
return LiveSetting::Off;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept {
|
|
178
|
+
if (value.now.has_value()) {
|
|
179
|
+
return std::to_string(value.now.value());
|
|
180
|
+
} else if (value.text.has_value()) {
|
|
181
|
+
return value.text.value();
|
|
182
|
+
} else {
|
|
183
|
+
return "";
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept {
|
|
188
|
+
auto strongView = view.view();
|
|
189
|
+
|
|
190
|
+
if (!strongView)
|
|
191
|
+
return;
|
|
192
|
+
|
|
193
|
+
auto baseView = strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::ComponentView>();
|
|
194
|
+
if (baseView == nullptr)
|
|
195
|
+
return;
|
|
196
|
+
|
|
197
|
+
auto props = std::static_pointer_cast<const facebook::react::ViewProps>(baseView->props());
|
|
198
|
+
if (props == nullptr)
|
|
199
|
+
return;
|
|
200
|
+
|
|
201
|
+
auto accessibilityActions = props->accessibilityActions;
|
|
202
|
+
for (size_t i = 0; i < accessibilityActions.size(); i++) {
|
|
203
|
+
if (accessibilityActions[i].name == action) {
|
|
204
|
+
baseView->GetEventEmitter()->onAccessibilityAction(action);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept {
|
|
210
|
+
if (expanded) {
|
|
211
|
+
return ExpandCollapseState_Expanded;
|
|
212
|
+
} else {
|
|
213
|
+
return ExpandCollapseState_Collapsed;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
165
217
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -29,4 +29,11 @@ void UpdateUiaProperty(
|
|
|
29
29
|
const std::string &oldValue,
|
|
30
30
|
const std::string &newValue) noexcept;
|
|
31
31
|
|
|
32
|
+
long GetLiveSetting(const std::string &liveRegion) noexcept;
|
|
33
|
+
|
|
34
|
+
std::string extractAccessibilityValue(const facebook::react::AccessibilityValue &value) noexcept;
|
|
35
|
+
|
|
36
|
+
void DispatchAccessibilityAction(::Microsoft::ReactNative::ReactTaggedView &view, const std::string &action) noexcept;
|
|
37
|
+
|
|
38
|
+
ExpandCollapseState GetExpandCollapseState(const bool &expanded) noexcept;
|
|
32
39
|
} // namespace winrt::Microsoft::ReactNative::implementation
|
|
@@ -24,8 +24,7 @@ UnimplementedNativeViewComponentView::UnimplementedNativeViewComponentView(
|
|
|
24
24
|
reactContext,
|
|
25
25
|
ComponentViewFeatures::Default &
|
|
26
26
|
~(ComponentViewFeatures::Background | ComponentViewFeatures::ShadowProps |
|
|
27
|
-
ComponentViewFeatures::NativeBorder)
|
|
28
|
-
false) {
|
|
27
|
+
ComponentViewFeatures::NativeBorder)) {
|
|
29
28
|
m_labelVisual = compContext.CreateSpriteVisual();
|
|
30
29
|
OuterVisual().InsertAt(m_labelVisual, 1);
|
|
31
30
|
}
|
|
@@ -38,8 +37,7 @@ winrt::Microsoft::ReactNative::ComponentView UnimplementedNativeViewComponentVie
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
void UnimplementedNativeViewComponentView::HandleCommand(
|
|
41
|
-
winrt::
|
|
42
|
-
const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept {
|
|
40
|
+
const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept {
|
|
43
41
|
// Do not call base to avoid unknown command asserts
|
|
44
42
|
}
|
|
45
43
|
|
|
@@ -25,8 +25,7 @@ struct UnimplementedNativeViewComponentView
|
|
|
25
25
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
26
26
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
27
27
|
|
|
28
|
-
void HandleCommand(
|
|
29
|
-
override;
|
|
28
|
+
void HandleCommand(const winrt::Microsoft::ReactNative::HandleCommandArgs &args) noexcept override;
|
|
30
29
|
|
|
31
30
|
UnimplementedNativeViewComponentView(
|
|
32
31
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
4
|
#include "pch.h"
|
|
5
|
+
#include "HandleCommandArgs.g.cpp"
|
|
6
|
+
#include "HandleCommandArgs.g.h"
|
|
5
7
|
#include <AsynchronousEventBeat.h>
|
|
6
8
|
#include <DynamicReader.h>
|
|
7
9
|
#include <DynamicWriter.h>
|
|
8
10
|
#include <Fabric/ComponentView.h>
|
|
9
11
|
#include <Fabric/Composition/CompositionUIService.h>
|
|
10
12
|
#include <Fabric/Composition/CompositionViewComponentView.h>
|
|
13
|
+
#include <Fabric/Composition/ReactNativeIsland.h>
|
|
11
14
|
#include <Fabric/Composition/RootComponentView.h>
|
|
12
15
|
#include <Fabric/FabricUIManagerModule.h>
|
|
13
16
|
#include <Fabric/ReactNativeConfigProperties.h>
|
|
@@ -160,7 +163,7 @@ void FabricUIManager::startSurface(
|
|
|
160
163
|
|
|
161
164
|
facebook::react::LayoutContext layoutContext;
|
|
162
165
|
layoutContext.pointScaleFactor = rootView.ScaleFactor();
|
|
163
|
-
layoutContext.fontSizeMultiplier = rootView.
|
|
166
|
+
layoutContext.fontSizeMultiplier = rootView.FontSizeMultiplier();
|
|
164
167
|
|
|
165
168
|
m_surfaceManager->startSurface(
|
|
166
169
|
surfaceId,
|
|
@@ -173,6 +176,9 @@ void FabricUIManager::startSurface(
|
|
|
173
176
|
|
|
174
177
|
void FabricUIManager::stopSurface(facebook::react::SurfaceId surfaceId) noexcept {
|
|
175
178
|
m_surfaceManager->stopSurface(surfaceId);
|
|
179
|
+
auto &rootDescriptor = m_registry.componentViewDescriptorWithTag(surfaceId);
|
|
180
|
+
m_registry.enqueueComponentViewWithComponentHandle(
|
|
181
|
+
facebook::react::RootShadowNode::Handle(), surfaceId, rootDescriptor);
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
winrt::Microsoft::ReactNative::ReactNativeIsland FabricUIManager::GetReactNativeIsland(
|
|
@@ -257,9 +263,10 @@ void FabricUIManager::RCTPerformMountInstructions(
|
|
|
257
263
|
newChildComponentView->updateEventEmitter(newChildShadowView.eventEmitter);
|
|
258
264
|
newChildComponentView->updateState(newChildShadowView.state, oldChildShadowView.state);
|
|
259
265
|
newChildComponentView->updateLayoutMetrics(newChildShadowView.layoutMetrics, oldChildShadowView.layoutMetrics);
|
|
260
|
-
|
|
266
|
+
newChildComponentView->FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask::All);
|
|
261
267
|
|
|
262
|
-
parentViewDescriptor.view
|
|
268
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(parentViewDescriptor.view)
|
|
269
|
+
->MountChildComponentView(*newChildComponentView, mutation.index);
|
|
263
270
|
break;
|
|
264
271
|
}
|
|
265
272
|
|
|
@@ -268,7 +275,8 @@ void FabricUIManager::RCTPerformMountInstructions(
|
|
|
268
275
|
auto &parentShadowView = mutation.parentShadowView;
|
|
269
276
|
auto &oldChildViewDescriptor = m_registry.componentViewDescriptorWithTag(oldChildShadowView.tag);
|
|
270
277
|
auto &parentViewDescriptor = m_registry.componentViewDescriptorWithTag(parentShadowView.tag);
|
|
271
|
-
parentViewDescriptor.view
|
|
278
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(parentViewDescriptor.view)
|
|
279
|
+
->UnmountChildComponentView(oldChildViewDescriptor.view, mutation.index);
|
|
272
280
|
break;
|
|
273
281
|
}
|
|
274
282
|
|
|
@@ -302,7 +310,8 @@ void FabricUIManager::RCTPerformMountInstructions(
|
|
|
302
310
|
}
|
|
303
311
|
|
|
304
312
|
if (mask != winrt::Microsoft::ReactNative::ComponentViewUpdateMask::None) {
|
|
305
|
-
newChildViewDescriptor.view
|
|
313
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(newChildViewDescriptor.view)
|
|
314
|
+
->FinalizeUpdates(mask);
|
|
306
315
|
}
|
|
307
316
|
|
|
308
317
|
break;
|
|
@@ -381,22 +390,44 @@ void FabricUIManager::schedulerDidRequestPreliminaryViewAllocation(
|
|
|
381
390
|
*/
|
|
382
391
|
}
|
|
383
392
|
|
|
393
|
+
struct HandleCommandArgs : public winrt::Microsoft::ReactNative::implementation::HandleCommandArgsT<HandleCommandArgs> {
|
|
394
|
+
HandleCommandArgs(winrt::hstring commandName, folly::dynamic const &arg) : m_commandName(commandName), m_args(arg) {}
|
|
395
|
+
|
|
396
|
+
winrt::hstring CommandName() const noexcept {
|
|
397
|
+
return m_commandName;
|
|
398
|
+
}
|
|
399
|
+
winrt::Microsoft::ReactNative::IJSValueReader CommandArgs() const noexcept {
|
|
400
|
+
return winrt::make<winrt::Microsoft::ReactNative::DynamicReader>(m_args);
|
|
401
|
+
}
|
|
402
|
+
bool Handled() const noexcept {
|
|
403
|
+
return m_handled;
|
|
404
|
+
}
|
|
405
|
+
void Handled(bool value) noexcept {
|
|
406
|
+
m_handled = value;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
private:
|
|
410
|
+
folly::dynamic const &m_args;
|
|
411
|
+
const winrt::hstring m_commandName;
|
|
412
|
+
bool m_handled{false};
|
|
413
|
+
};
|
|
414
|
+
|
|
384
415
|
void FabricUIManager::schedulerDidDispatchCommand(
|
|
385
416
|
facebook::react::ShadowView const &shadowView,
|
|
386
417
|
std::string const &commandName,
|
|
387
418
|
folly::dynamic const &arg) {
|
|
388
419
|
if (m_context.UIDispatcher().HasThreadAccess()) {
|
|
389
420
|
auto descriptor = m_registry.componentViewDescriptorWithTag(shadowView.tag);
|
|
390
|
-
descriptor.view
|
|
391
|
-
winrt::to_hstring(commandName),
|
|
421
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(descriptor.view)
|
|
422
|
+
->HandleCommand(winrt::make<HandleCommandArgs>(winrt::to_hstring(commandName), arg));
|
|
392
423
|
} else {
|
|
393
424
|
m_context.UIDispatcher().Post(
|
|
394
425
|
[wkThis = weak_from_this(), commandName, tag = shadowView.tag, args = folly::dynamic(arg)]() {
|
|
395
426
|
if (auto pThis = wkThis.lock()) {
|
|
396
427
|
auto view = pThis->m_registry.findComponentViewWithTag(tag);
|
|
397
428
|
if (view) {
|
|
398
|
-
view
|
|
399
|
-
winrt::to_hstring(commandName),
|
|
429
|
+
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(view)->HandleCommand(
|
|
430
|
+
winrt::make<HandleCommandArgs>(winrt::to_hstring(commandName), args));
|
|
400
431
|
}
|
|
401
432
|
}
|
|
402
433
|
});
|
|
@@ -74,9 +74,7 @@ void WindowsComponentDescriptorRegistry::Add(
|
|
|
74
74
|
m_descriptorFlavors.back()->c_str(),
|
|
75
75
|
std::static_pointer_cast<void const>(m_descriptorFlavors.back()),
|
|
76
76
|
winrt::get_self<winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder>(builder)
|
|
77
|
-
|
|
78
|
-
? &facebook::react::concreteComponentDescriptorConstructor<AbiViewComponentDescriptor>
|
|
79
|
-
: &facebook::react::concreteComponentDescriptorConstructor<AbiComponentDescriptor>});
|
|
77
|
+
->GetComponentDescriptorProvider()});
|
|
80
78
|
}
|
|
81
79
|
|
|
82
80
|
winrt::Microsoft::ReactNative::IReactViewComponentBuilder WindowsComponentDescriptorRegistry::GetDescriptor(
|
|
@@ -26,7 +26,27 @@ HostPlatformViewProps::HostPlatformViewProps(
|
|
|
26
26
|
focusable(
|
|
27
27
|
CoreFeatures::enablePropIteratorSetter
|
|
28
28
|
? sourceProps.focusable
|
|
29
|
-
: convertRawProp(context, rawProps, "focusable", sourceProps.focusable, {}))
|
|
29
|
+
: convertRawProp(context, rawProps, "focusable", sourceProps.focusable, {})),
|
|
30
|
+
tooltip(
|
|
31
|
+
CoreFeatures::enablePropIteratorSetter
|
|
32
|
+
? sourceProps.tooltip
|
|
33
|
+
: convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {})),
|
|
34
|
+
accessibilityPosInSet(
|
|
35
|
+
CoreFeatures::enablePropIteratorSetter
|
|
36
|
+
? sourceProps.accessibilityPosInSet
|
|
37
|
+
: convertRawProp(context, rawProps, "accessibilityPosInSet", sourceProps.accessibilityPosInSet, 0)),
|
|
38
|
+
accessibilitySetSize(
|
|
39
|
+
CoreFeatures::enablePropIteratorSetter
|
|
40
|
+
? sourceProps.accessibilitySetSize
|
|
41
|
+
: convertRawProp(context, rawProps, "accessibilitySetSize", sourceProps.accessibilitySetSize, 0)),
|
|
42
|
+
accessibilityLiveRegion(
|
|
43
|
+
CoreFeatures::enablePropIteratorSetter ? sourceProps.accessibilityLiveRegion
|
|
44
|
+
: convertRawProp(
|
|
45
|
+
context,
|
|
46
|
+
rawProps,
|
|
47
|
+
"accessibilityLiveRegion",
|
|
48
|
+
sourceProps.accessibilityLiveRegion,
|
|
49
|
+
"none")) {}
|
|
30
50
|
|
|
31
51
|
#define WINDOWS_VIEW_EVENT_CASE(eventType) \
|
|
32
52
|
case CONSTEXPR_RAW_PROPS_KEY_HASH("on" #eventType): { \
|
|
@@ -61,8 +81,12 @@ void HostPlatformViewProps::setProp(
|
|
|
61
81
|
WINDOWS_VIEW_EVENT_CASE(MouseLeave);
|
|
62
82
|
RAW_SET_PROP_SWITCH_CASE_BASIC(enableFocusRing);
|
|
63
83
|
RAW_SET_PROP_SWITCH_CASE_BASIC(focusable);
|
|
84
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityPosInSet);
|
|
85
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilitySetSize);
|
|
86
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(accessibilityLiveRegion);
|
|
64
87
|
RAW_SET_PROP_SWITCH_CASE_BASIC(keyDownEvents);
|
|
65
88
|
RAW_SET_PROP_SWITCH_CASE_BASIC(keyUpEvents);
|
|
89
|
+
RAW_SET_PROP_SWITCH_CASE_BASIC(tooltip);
|
|
66
90
|
}
|
|
67
91
|
}
|
|
68
92
|
|
package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h
CHANGED
|
@@ -24,9 +24,12 @@ class HostPlatformViewProps : public BaseViewProps {
|
|
|
24
24
|
WindowsViewEvents windowsEvents{};
|
|
25
25
|
bool enableFocusRing{true};
|
|
26
26
|
bool focusable{false};
|
|
27
|
+
int accessibilityPosInSet{0};
|
|
28
|
+
int accessibilitySetSize{0};
|
|
29
|
+
std::string accessibilityLiveRegion{"none"};
|
|
27
30
|
|
|
28
31
|
// std::optional<std::string> overflowAnchor{};
|
|
29
|
-
|
|
32
|
+
std::optional<std::string> tooltip{};
|
|
30
33
|
std::vector<HandledKeyEvent> keyDownEvents{};
|
|
31
34
|
std::vector<HandledKeyEvent> keyUpEvents{};
|
|
32
35
|
};
|
|
@@ -13,7 +13,7 @@ inline bool formsStackingContext(ViewProps const &viewProps) {
|
|
|
13
13
|
// Only Views which are marked as focusable can actually trigger the events, which will already avoid being collapsed.
|
|
14
14
|
constexpr decltype(WindowsViewEvents::bits) focusEventsMask = {
|
|
15
15
|
(1 << (int)WindowsViewEvents::Offset::Focus) & (1 << (int)WindowsViewEvents::Offset::Blur)};
|
|
16
|
-
return (viewProps.windowsEvents.bits & focusEventsMask).any();
|
|
16
|
+
return (viewProps.windowsEvents.bits & focusEventsMask).any() || viewProps.tooltip;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
inline bool formsView(ViewProps const &viewProps) {
|
package/Microsoft.ReactNative/Fabric/platform/react/renderer/textlayoutmanager/TextLayoutManager.cpp
CHANGED
|
@@ -43,7 +43,10 @@ void TextLayoutManager::GetTextLayout(
|
|
|
43
43
|
static_cast<facebook::react::FontWeight>(DWRITE_FONT_WEIGHT_REGULAR))),
|
|
44
44
|
style,
|
|
45
45
|
DWRITE_FONT_STRETCH_NORMAL,
|
|
46
|
-
outerFragment.textAttributes.
|
|
46
|
+
(outerFragment.textAttributes.allowFontScaling.value_or(true) &&
|
|
47
|
+
!std::isnan(outerFragment.textAttributes.fontSizeMultiplier))
|
|
48
|
+
? (outerFragment.textAttributes.fontSizeMultiplier * outerFragment.textAttributes.fontSize)
|
|
49
|
+
: outerFragment.textAttributes.fontSize,
|
|
47
50
|
L"",
|
|
48
51
|
spTextFormat.put()));
|
|
49
52
|
|
|
@@ -118,7 +121,11 @@ void TextLayoutManager::GetTextLayout(
|
|
|
118
121
|
attributes.fontWeight.value_or(static_cast<facebook::react::FontWeight>(DWRITE_FONT_WEIGHT_REGULAR))),
|
|
119
122
|
range));
|
|
120
123
|
winrt::check_hresult(spTextLayout->SetFontStyle(fragmentStyle, range));
|
|
121
|
-
winrt::check_hresult(spTextLayout->SetFontSize(
|
|
124
|
+
winrt::check_hresult(spTextLayout->SetFontSize(
|
|
125
|
+
(attributes.allowFontScaling.value_or(true) && !std::isnan(attributes.fontSizeMultiplier))
|
|
126
|
+
? (attributes.fontSizeMultiplier * attributes.fontSize)
|
|
127
|
+
: attributes.fontSize,
|
|
128
|
+
range));
|
|
122
129
|
|
|
123
130
|
if (!isnan(attributes.letterSpacing)) {
|
|
124
131
|
winrt::check_hresult(
|
|
@@ -13,16 +13,26 @@ import "CompositionComponentView.idl";
|
|
|
13
13
|
|
|
14
14
|
namespace Microsoft.ReactNative.Composition
|
|
15
15
|
{
|
|
16
|
+
[webhosthidden]
|
|
17
|
+
[experimental]
|
|
18
|
+
delegate void ViewComponentViewInitializer(ViewComponentView view);
|
|
19
|
+
|
|
20
|
+
[webhosthidden]
|
|
16
21
|
[experimental]
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
delegate void ComponentIslandComponentViewInitializer(ContentIslandComponentView view);
|
|
23
|
+
|
|
24
|
+
[experimental]
|
|
25
|
+
[webhosthidden]
|
|
26
|
+
delegate Microsoft.UI.Composition.Visual CreateVisualDelegate(Microsoft.ReactNative.ComponentView view);
|
|
19
27
|
|
|
20
28
|
[webhosthidden]
|
|
21
29
|
[experimental]
|
|
22
30
|
DOC_STRING(".")
|
|
23
31
|
interface IReactCompositionViewComponentBuilder
|
|
24
32
|
{
|
|
25
|
-
void
|
|
33
|
+
void SetViewComponentViewInitializer(ViewComponentViewInitializer initializer);
|
|
34
|
+
void SetContentIslandComponentViewInitializer(ComponentIslandComponentViewInitializer initializer);
|
|
35
|
+
void SetCreateVisualHandler(CreateVisualDelegate impl);
|
|
26
36
|
};
|
|
27
37
|
|
|
28
38
|
} // namespace Microsoft.ReactNative
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import "ViewProps.idl";
|
|
5
5
|
import "ComponentView.idl";
|
|
6
|
+
import "IJSValueWriter.idl";
|
|
6
7
|
|
|
7
8
|
#include "DocString.h"
|
|
8
9
|
|
|
@@ -34,6 +35,25 @@ namespace Microsoft.ReactNative
|
|
|
34
35
|
LayoutDirection LayoutDirection;
|
|
35
36
|
};
|
|
36
37
|
|
|
38
|
+
[experimental]
|
|
39
|
+
runtimeclass MountChildComponentViewArgs {
|
|
40
|
+
ComponentView Child { get; };
|
|
41
|
+
UInt32 Index { get; };
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
[experimental]
|
|
45
|
+
runtimeclass UnmountChildComponentViewArgs {
|
|
46
|
+
ComponentView Child { get; };
|
|
47
|
+
UInt32 Index { get; };
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
[experimental]
|
|
51
|
+
runtimeclass HandleCommandArgs {
|
|
52
|
+
String CommandName { get; };
|
|
53
|
+
IJSValueReader CommandArgs { get; };
|
|
54
|
+
Boolean Handled;
|
|
55
|
+
};
|
|
56
|
+
|
|
37
57
|
[experimental]
|
|
38
58
|
DOC_STRING("A delegate that creates a @IComponentProps object for an instance of @ViewProps. See @IReactViewComponentBuilder.SetCreateProps")
|
|
39
59
|
delegate IComponentProps ViewPropsFactory(ViewProps props);
|
|
@@ -54,15 +74,39 @@ namespace Microsoft.ReactNative
|
|
|
54
74
|
delegate Object InitialStateDataFactory(IComponentProps props);
|
|
55
75
|
|
|
56
76
|
[experimental]
|
|
57
|
-
DOC_STRING("Provides a
|
|
58
|
-
delegate
|
|
77
|
+
DOC_STRING("Provides a method to initialize an instance of a ComponentView. See @IReactViewComponentBuilder.SetComponentViewInitializer")
|
|
78
|
+
delegate void ComponentViewInitializer(ComponentView view);
|
|
79
|
+
|
|
80
|
+
[experimental]
|
|
81
|
+
delegate void HandleCommandDelegate(ComponentView source, HandleCommandArgs args);
|
|
82
|
+
|
|
83
|
+
[experimental]
|
|
84
|
+
delegate void UpdateFinalizerDelegate(ComponentView source, ComponentViewUpdateMask updateMask);
|
|
85
|
+
|
|
86
|
+
[experimental]
|
|
87
|
+
delegate void UpdatePropsDelegate(ComponentView source, IComponentProps newProps, IComponentProps oldProps);
|
|
88
|
+
|
|
89
|
+
[experimental]
|
|
90
|
+
delegate void UpdateStateDelegate(ComponentView source, IComponentState newState);
|
|
91
|
+
|
|
92
|
+
[experimental]
|
|
93
|
+
delegate void MountChildComponentViewDelegate(ComponentView source, MountChildComponentViewArgs args);
|
|
94
|
+
|
|
95
|
+
[experimental]
|
|
96
|
+
delegate void UnmountChildComponentViewDelegate(ComponentView source, UnmountChildComponentViewArgs args);
|
|
97
|
+
|
|
98
|
+
[experimental]
|
|
99
|
+
runtimeclass EventEmitter {
|
|
100
|
+
void DispatchEvent(String eventName, JSValueArgWriter args);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
[experimental]
|
|
104
|
+
delegate void UpdateEventEmitterDelegate(ComponentView source, EventEmitter eventEmitter);
|
|
59
105
|
|
|
60
106
|
[webhosthidden]
|
|
61
107
|
[experimental]
|
|
62
108
|
interface IReactViewComponentBuilder
|
|
63
109
|
{
|
|
64
|
-
void SetCreateComponentView(ComponentViewFactory impl);
|
|
65
|
-
|
|
66
110
|
DOC_STRING("Create an implementation of your custom Props type that will be passed to your components @Composition.ICompositionViewComponent.UpdateProps method.")
|
|
67
111
|
void SetCreateProps(ViewPropsFactory impl);
|
|
68
112
|
|
|
@@ -71,9 +115,24 @@ namespace Microsoft.ReactNative
|
|
|
71
115
|
void SetInitialStateDataFactory(InitialStateDataFactory impl);
|
|
72
116
|
void SetMeasureContentHandler(MeasureContentHandler impl);
|
|
73
117
|
void SetLayoutHandler(LayoutHandler impl);
|
|
118
|
+
|
|
119
|
+
void SetComponentViewInitializer(ComponentViewInitializer initializer);
|
|
120
|
+
void SetCustomCommandHandler(HandleCommandDelegate impl);
|
|
121
|
+
void SetFinalizeUpdateHandler(UpdateFinalizerDelegate impl);
|
|
122
|
+
void SetUpdatePropsHandler(UpdatePropsDelegate impl);
|
|
123
|
+
void SetUpdateStateHandler(UpdateStateDelegate impl);
|
|
124
|
+
void SetUpdateEventEmitterHandler(UpdateEventEmitterDelegate impl);
|
|
125
|
+
void SetMountChildComponentViewHandler(MountChildComponentViewDelegate impl);
|
|
126
|
+
void SetUnmountChildComponentViewHandler(UnmountChildComponentViewDelegate impl);
|
|
74
127
|
};
|
|
75
128
|
|
|
129
|
+
// [exclusiveto(ShadowNode)]
|
|
130
|
+
// [uuid(BF2A2A64-AB8B-47FC-BE69-E31DE6FC29A4)]
|
|
131
|
+
// interface IShadowNodeFactory
|
|
132
|
+
// {
|
|
133
|
+
// }
|
|
76
134
|
|
|
135
|
+
// [composable(IShadowNodeFactory, protected)]
|
|
77
136
|
[webhosthidden]
|
|
78
137
|
[experimental]
|
|
79
138
|
unsealed runtimeclass ShadowNode
|
|
@@ -81,6 +140,7 @@ namespace Microsoft.ReactNative
|
|
|
81
140
|
void EnsureUnsealed();
|
|
82
141
|
Object Tag { get; set; };
|
|
83
142
|
Object StateData{ get; set; };
|
|
143
|
+
EventEmitter EventEmitter { get; };
|
|
84
144
|
};
|
|
85
145
|
|
|
86
146
|
[webhosthidden]
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
143
143
|
</ClCompile>
|
|
144
144
|
<Link>
|
|
145
|
-
<AdditionalDependencies>winsqlite3.lib;ChakraRT.lib;dxguid.lib;dloadhelper.lib;OneCoreUap_apiset.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
145
|
+
<AdditionalDependencies>winsqlite3.lib;ChakraRT.lib;dxguid.lib;dloadhelper.lib;OneCoreUap_apiset.lib;Dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
146
146
|
<DelayLoadDLLs>
|
|
147
147
|
api-ms-win-core-file-l1-2-0.dll;
|
|
148
148
|
api-ms-win-core-windowserrorreporting-l1-1-0.dll;
|
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
|
|
20
20
|
namespace Microsoft::ReactNative {
|
|
21
21
|
|
|
22
|
+
LogBox::~LogBox() {
|
|
23
|
+
#ifdef USE_FABRIC
|
|
24
|
+
if (m_hwnd) {
|
|
25
|
+
m_context.UIDispatcher().Post([hwnd = m_hwnd]() { DestroyWindow(hwnd); });
|
|
26
|
+
m_hwnd = nullptr;
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
#ifdef USE_FABRIC
|
|
23
32
|
constexpr PCWSTR c_logBoxWindowClassName = L"MS_REACTNATIVE_LOGBOX";
|
|
24
33
|
constexpr auto CompHostProperty = L"CompHost";
|
|
@@ -14,6 +14,8 @@ REACT_MODULE(LogBox)
|
|
|
14
14
|
struct LogBox : public std::enable_shared_from_this<LogBox> {
|
|
15
15
|
using ModuleSpec = ReactNativeSpecs::LogBoxSpec;
|
|
16
16
|
|
|
17
|
+
~LogBox();
|
|
18
|
+
|
|
17
19
|
REACT_INIT(Initialize)
|
|
18
20
|
void Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept;
|
|
19
21
|
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT License.
|
|
3
|
+
|
|
4
|
+
#include "pch.h"
|
|
5
|
+
#include "SampleTurboModule.h"
|
|
6
|
+
|
|
7
|
+
namespace Microsoft::ReactNative {
|
|
8
|
+
|
|
9
|
+
void SampleTurboModule::Initialize(winrt::Microsoft::ReactNative::ReactContext const &reactContext) noexcept {
|
|
10
|
+
m_reactContext = reactContext;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
ReactNativeSpecs::SampleTurboModuleSpec_Constants SampleTurboModule::GetConstants() noexcept {
|
|
14
|
+
ReactNativeSpecs::SampleTurboModuleSpec_Constants constants;
|
|
15
|
+
constants.const1 = true;
|
|
16
|
+
constants.const2 = 375;
|
|
17
|
+
constants.const3 = "something";
|
|
18
|
+
return constants;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void SampleTurboModule::voidFunc() noexcept {}
|
|
22
|
+
|
|
23
|
+
bool SampleTurboModule::getBool(bool arg) noexcept {
|
|
24
|
+
return arg;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
double SampleTurboModule::getEnum(double arg) noexcept {
|
|
28
|
+
return arg;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
double SampleTurboModule::getNumber(double arg) noexcept {
|
|
32
|
+
return arg;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
std::string SampleTurboModule::getString(std::string arg) noexcept {
|
|
36
|
+
return std::string(arg);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
::React::JSValueArray SampleTurboModule::getArray(::React::JSValueArray &&arg) noexcept {
|
|
40
|
+
return arg.Copy();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
::React::JSValue SampleTurboModule::getObject(::React::JSValue &&arg) noexcept {
|
|
44
|
+
assert(arg.Type() == ::React::JSValueType::Object);
|
|
45
|
+
return arg.Copy();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
::React::JSValue SampleTurboModule::getUnsafeObject(::React::JSValue &&arg) noexcept {
|
|
49
|
+
assert(arg.Type() == ::React::JSValueType::Object);
|
|
50
|
+
return arg.Copy();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
double SampleTurboModule::getRootTag(double arg) noexcept {
|
|
54
|
+
// TODO: Proper impl
|
|
55
|
+
return arg;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
::React::JSValue SampleTurboModule::getValue(double x, std::string y, ::React::JSValue &&z) noexcept {
|
|
59
|
+
return ::React::JSValueObject{
|
|
60
|
+
{"x", x},
|
|
61
|
+
{"y", y},
|
|
62
|
+
{"z", z.Copy()},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void SampleTurboModule::getValueWithCallback(std::function<void(std::string)> const &callback) noexcept {
|
|
67
|
+
callback("value from callback!");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void SampleTurboModule::getValueWithPromise(bool error, ::React::ReactPromise<std::string> &&result) noexcept {
|
|
71
|
+
if (error) {
|
|
72
|
+
result.Reject("intentional promise rejection");
|
|
73
|
+
} else {
|
|
74
|
+
result.Resolve("result!");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
void SampleTurboModule::voidFuncThrows() noexcept {
|
|
79
|
+
// TODO: Proper impl
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
::React::JSValue SampleTurboModule::getObjectThrows(::React::JSValue &&arg) noexcept {
|
|
83
|
+
// TODO: Proper impl
|
|
84
|
+
return nullptr;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
void SampleTurboModule::promiseThrows(::React::ReactPromise<void> &&result) noexcept {
|
|
88
|
+
// TODO: Proper impl
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
void SampleTurboModule::voidFuncAssert() noexcept {
|
|
92
|
+
// TODO: Proper impl
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
::React::JSValue SampleTurboModule::getObjectAssert(::React::JSValue &&arg) noexcept {
|
|
96
|
+
// TODO: Proper impl
|
|
97
|
+
return nullptr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
void SampleTurboModule::promiseAssert(::React::ReactPromise<void> &&result) noexcept {
|
|
101
|
+
// TODO: Proper impl
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
} // namespace Microsoft::ReactNative
|