react-native-windows 0.74.20 → 0.74.21
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 +33 -32
- package/Microsoft.ReactNative/Composition.Input.idl +2 -0
- package/Microsoft.ReactNative/CompositionComponentView.idl +43 -24
- 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 +318 -59
- package/Microsoft.ReactNative/Fabric/ComponentView.h +155 -33
- 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 +25 -7
- package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +22 -4
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +43 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +6 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +147 -119
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +4 -8
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +97 -101
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +28 -52
- 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 +1 -2
- package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +1 -4
- package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +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 +57 -1
- package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +6 -0
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +8 -2
- package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -0
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +195 -182
- package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +1 -3
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.cpp +16 -4
- package/Microsoft.ReactNative/Fabric/Composition/SwitchComponentView.h +3 -3
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +12 -17
- package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +4 -11
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +19 -0
- package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +4 -0
- package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +1 -2
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +10 -7
- package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +1 -3
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +20 -1
- package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +3 -0
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +13 -3
- package/Microsoft.ReactNative/IReactViewComponentBuilder.idl +57 -4
- package/Microsoft.ReactNative/ReactNativeIsland.idl +3 -0
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/PropertySheets/WinUI.props +1 -1
- package/Shared/Shared.vcxitems +7 -0
- package/Shared/Shared.vcxitems.filters +1 -0
- package/just-task.js +1 -1
- package/package.json +3 -3
|
@@ -42,7 +42,7 @@ struct ScrollBarComponent {
|
|
|
42
42
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
43
43
|
winrt::Microsoft::ReactNative::ReactContext const &reactContext,
|
|
44
44
|
bool vertical)
|
|
45
|
-
:
|
|
45
|
+
: m_wkOuter(outer), m_compContext(compContext), m_reactContext(reactContext), m_vertical(vertical) {
|
|
46
46
|
m_rootVisual = m_compContext.CreateSpriteVisual();
|
|
47
47
|
m_trackVisual = m_compContext.CreateRoundedRectangleVisual();
|
|
48
48
|
m_thumbVisual = m_compContext.CreateRoundedRectangleVisual();
|
|
@@ -73,9 +73,11 @@ struct ScrollBarComponent {
|
|
|
73
73
|
updateHighlight(ScrollbarHitRegion::ArrowLast);
|
|
74
74
|
updateHighlight(ScrollbarHitRegion::Thumb);
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
if (auto outer = m_wkOuter.get()) {
|
|
77
|
+
m_trackVisual.Brush(
|
|
78
|
+
winrt::get_self<winrt::Microsoft::ReactNative::Composition::implementation::Theme>(outer.Theme())
|
|
79
|
+
->InternalPlatformBrush(L"ScrollBarTrackFill"));
|
|
80
|
+
}
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
void ContentSize(winrt::Windows::Foundation::Size contentSize) noexcept {
|
|
@@ -293,19 +295,21 @@ struct ScrollBarComponent {
|
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
void OnPointerReleased(const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) {
|
|
296
|
-
if (
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
298
|
+
if (auto outer = m_wkOuter.get()) {
|
|
299
|
+
if (!m_visible)
|
|
300
|
+
return;
|
|
301
|
+
auto pt = args.GetCurrentPoint(outer.Tag());
|
|
302
|
+
if (m_nTrackInputOffset != -1 &&
|
|
303
|
+
pt.PointerDeviceType() == winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse &&
|
|
304
|
+
pt.Properties().PointerUpdateKind() ==
|
|
305
|
+
winrt::Microsoft::ReactNative::Composition::Input::PointerUpdateKind::LeftButtonReleased) {
|
|
306
|
+
handleMoveThumb(args);
|
|
307
|
+
stopTrackingThumb();
|
|
308
|
+
outer.ReleasePointerCapture(args.Pointer());
|
|
309
|
+
|
|
310
|
+
auto reg = HitTest(pt.Position());
|
|
311
|
+
updateShy(reg == ScrollbarHitRegion::Unknown);
|
|
312
|
+
}
|
|
309
313
|
}
|
|
310
314
|
}
|
|
311
315
|
|
|
@@ -318,78 +322,85 @@ struct ScrollBarComponent {
|
|
|
318
322
|
}
|
|
319
323
|
|
|
320
324
|
void handleMoveThumb(const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) {
|
|
321
|
-
auto
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
325
|
+
if (auto outer = m_wkOuter.get()) {
|
|
326
|
+
auto pt = args.GetCurrentPoint(outer.Tag());
|
|
327
|
+
auto pos = pt.Position();
|
|
328
|
+
|
|
329
|
+
auto newTrackingPosition = static_cast<int>((m_vertical ? pos.Y : pos.X) * m_scaleFactor) - m_nTrackInputOffset;
|
|
330
|
+
winrt::get_self<ScrollViewComponentView>(outer)->scrollTo(
|
|
331
|
+
m_vertical ? winrt::Windows::Foundation::Numerics::
|
|
332
|
+
float3{m_offset.x, scrollOffsetFromThumbPos(newTrackingPosition), m_offset.z}
|
|
333
|
+
: winrt::Windows::Foundation::Numerics::
|
|
334
|
+
float3{scrollOffsetFromThumbPos(newTrackingPosition), m_offset.y, m_offset.z},
|
|
335
|
+
false);
|
|
336
|
+
}
|
|
331
337
|
args.Handled(true);
|
|
332
338
|
}
|
|
333
339
|
|
|
334
340
|
void OnPointerPressed(const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) {
|
|
335
|
-
if (
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
+
if (auto outer = m_wkOuter.get()) {
|
|
342
|
+
if (!m_visible)
|
|
343
|
+
return;
|
|
344
|
+
auto pt = args.GetCurrentPoint(outer.Tag());
|
|
345
|
+
if (pt.PointerDeviceType() == winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse) {
|
|
346
|
+
auto pos = pt.Position();
|
|
347
|
+
auto reg = HitTest(pos);
|
|
341
348
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
349
|
+
switch (reg) {
|
|
350
|
+
case ScrollbarHitRegion::ArrowFirst:
|
|
351
|
+
if (m_vertical) {
|
|
352
|
+
winrt::get_self<ScrollViewComponentView>(outer)->lineUp(false);
|
|
353
|
+
} else {
|
|
354
|
+
winrt::get_self<ScrollViewComponentView>(outer)->lineLeft(false);
|
|
355
|
+
}
|
|
356
|
+
args.Handled(true);
|
|
357
|
+
break;
|
|
358
|
+
case ScrollbarHitRegion::ArrowLast:
|
|
359
|
+
if (m_vertical) {
|
|
360
|
+
winrt::get_self<ScrollViewComponentView>(outer)->lineDown(false);
|
|
361
|
+
} else {
|
|
362
|
+
winrt::get_self<ScrollViewComponentView>(outer)->lineRight(false);
|
|
363
|
+
}
|
|
364
|
+
args.Handled(true);
|
|
365
|
+
break;
|
|
366
|
+
case ScrollbarHitRegion::PageUp:
|
|
367
|
+
if (m_vertical) {
|
|
368
|
+
winrt::get_self<ScrollViewComponentView>(outer)->pageUp(false);
|
|
369
|
+
}
|
|
370
|
+
args.Handled(true);
|
|
371
|
+
break;
|
|
372
|
+
case ScrollbarHitRegion::PageDown:
|
|
373
|
+
if (m_vertical) {
|
|
374
|
+
winrt::get_self<ScrollViewComponentView>(outer)->pageDown(false);
|
|
375
|
+
}
|
|
376
|
+
args.Handled(true);
|
|
377
|
+
break;
|
|
378
|
+
case ScrollbarHitRegion::Thumb: {
|
|
379
|
+
outer.CapturePointer(args.Pointer());
|
|
380
|
+
m_nTrackInputOffset = static_cast<int>((m_vertical ? pos.Y : pos.X) * m_scaleFactor) - m_thumbPos;
|
|
381
|
+
m_thumbVisual.AnimationClass(
|
|
382
|
+
winrt::Microsoft::ReactNative::Composition::Experimental::AnimationClass::None);
|
|
383
|
+
handleMoveThumb(args);
|
|
368
384
|
}
|
|
369
|
-
args.Handled(true);
|
|
370
|
-
break;
|
|
371
|
-
case ScrollbarHitRegion::Thumb: {
|
|
372
|
-
m_outer.CapturePointer(args.Pointer());
|
|
373
|
-
m_nTrackInputOffset = static_cast<int>((m_vertical ? pos.Y : pos.X) * m_scaleFactor) - m_thumbPos;
|
|
374
|
-
m_thumbVisual.AnimationClass(winrt::Microsoft::ReactNative::Composition::Experimental::AnimationClass::None);
|
|
375
|
-
handleMoveThumb(args);
|
|
376
385
|
}
|
|
377
386
|
}
|
|
378
387
|
}
|
|
379
388
|
}
|
|
380
389
|
|
|
381
390
|
void OnPointerMoved(const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) {
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
if (auto outer = m_wkOuter.get()) {
|
|
392
|
+
if (!m_visible)
|
|
393
|
+
return;
|
|
394
|
+
auto pt = args.GetCurrentPoint(outer.Tag());
|
|
395
|
+
if (pt.PointerDeviceType() == winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType::Mouse) {
|
|
396
|
+
if (m_nTrackInputOffset != -1) {
|
|
397
|
+
handleMoveThumb(args);
|
|
398
|
+
} else {
|
|
399
|
+
auto pos = pt.Position();
|
|
400
|
+
auto reg = HitTest(pos);
|
|
401
|
+
updateShy(reg == ScrollbarHitRegion::Unknown);
|
|
402
|
+
setHighlightedRegion(reg);
|
|
403
|
+
}
|
|
393
404
|
}
|
|
394
405
|
}
|
|
395
406
|
}
|
|
@@ -427,122 +438,126 @@ struct ScrollBarComponent {
|
|
|
427
438
|
|
|
428
439
|
// Renders the text into our composition surface
|
|
429
440
|
void drawArrow(ScrollbarHitRegion region, bool disabled, bool hovered) noexcept {
|
|
430
|
-
auto
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
drawingSurface
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
if (auto outer = m_wkOuter.get()) {
|
|
442
|
+
auto &drawingSurface =
|
|
443
|
+
(region == ScrollbarHitRegion::ArrowFirst) ? m_arrowFirstDrawingSurface : m_arrowLastDrawingSurface;
|
|
444
|
+
if (!drawingSurface) {
|
|
445
|
+
drawingSurface = m_compContext.CreateDrawingSurfaceBrush(
|
|
446
|
+
{m_arrowSize, m_arrowSize},
|
|
447
|
+
winrt::Windows::Graphics::DirectX::DirectXPixelFormat::B8G8R8A8UIntNormalized,
|
|
448
|
+
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied);
|
|
449
|
+
}
|
|
438
450
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
451
|
+
if (winrt::get_self<ScrollViewComponentView>(outer)->theme()->IsEmpty()) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
442
454
|
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
455
|
+
winrt::com_ptr<IDWriteTextFormat> spTextFormat;
|
|
456
|
+
winrt::check_hresult(::Microsoft::ReactNative::DWriteFactory()->CreateTextFormat(
|
|
457
|
+
L"Segoe Fluent Icons",
|
|
458
|
+
nullptr, // Font collection (nullptr sets it to use the system font collection).
|
|
459
|
+
DWRITE_FONT_WEIGHT_REGULAR,
|
|
460
|
+
DWRITE_FONT_STYLE_NORMAL,
|
|
461
|
+
DWRITE_FONT_STRETCH_NORMAL,
|
|
462
|
+
8, // Xaml resource: ScrollBarButtonArrowIconFontSize
|
|
463
|
+
L"",
|
|
464
|
+
spTextFormat.put()));
|
|
465
|
+
|
|
466
|
+
winrt::check_hresult(spTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER));
|
|
467
|
+
|
|
468
|
+
winrt::com_ptr<IDWriteTextLayout> spTextLayout;
|
|
469
|
+
winrt::check_hresult(::Microsoft::ReactNative::DWriteFactory()->CreateTextLayout(
|
|
470
|
+
m_vertical ? ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDDB" : L"\uEDDC")
|
|
471
|
+
: ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDD9" : L"\uEDDA"),
|
|
472
|
+
1, // The length of the string.
|
|
473
|
+
spTextFormat.get(), // The text format to apply to the string (contains font information, etc).
|
|
474
|
+
(m_arrowSize / m_scaleFactor), // The width of the layout box.
|
|
475
|
+
(m_arrowSize / m_scaleFactor), // The height of the layout box.
|
|
476
|
+
spTextLayout.put() // The IDWriteTextLayout interface pointer.
|
|
477
|
+
));
|
|
478
|
+
|
|
479
|
+
POINT offset;
|
|
480
|
+
{
|
|
481
|
+
::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingSurface, m_scaleFactor, &offset);
|
|
482
|
+
if (auto d2dDeviceContext = autoDraw.GetRenderTarget()) {
|
|
483
|
+
d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Black, 0.0f));
|
|
484
|
+
assert(d2dDeviceContext->GetUnitMode() == D2D1_UNIT_MODE_DIPS);
|
|
485
|
+
|
|
486
|
+
// Create a solid color brush for the text. A more sophisticated application might want
|
|
487
|
+
// to cache and reuse a brush across all text elements instead, taking care to recreate
|
|
488
|
+
// it in the event of device removed.
|
|
489
|
+
winrt::com_ptr<ID2D1SolidColorBrush> brush;
|
|
490
|
+
|
|
491
|
+
D2D1::ColorF color{0};
|
|
492
|
+
if (disabled) {
|
|
493
|
+
color = winrt::get_self<ScrollViewComponentView>(outer)->theme()->D2DPlatformColor(
|
|
494
|
+
"ScrollBarButtonArrowForegroundDisabled");
|
|
495
|
+
} else if (hovered) {
|
|
496
|
+
color = winrt::get_self<ScrollViewComponentView>(outer)->theme()->D2DPlatformColor(
|
|
497
|
+
"ScrollBarButtonArrowForegroundPointerOver");
|
|
498
|
+
} else {
|
|
499
|
+
color = winrt::get_self<ScrollViewComponentView>(outer)->theme()->D2DPlatformColor(
|
|
500
|
+
"ScrollBarButtonArrowForeground");
|
|
501
|
+
}
|
|
502
|
+
winrt::check_hresult(d2dDeviceContext->CreateSolidColorBrush(color, brush.put()));
|
|
491
503
|
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
504
|
+
{
|
|
505
|
+
DWRITE_TEXT_METRICS dtm{};
|
|
506
|
+
winrt::check_hresult(spTextLayout->GetMetrics(&dtm));
|
|
507
|
+
offset.y += static_cast<int>((m_arrowSize - dtm.height) / 2.0f);
|
|
508
|
+
}
|
|
497
509
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
510
|
+
// Draw the line of text at the specified offset, which corresponds to the top-left
|
|
511
|
+
// corner of our drawing surface. Notice we don't call BeginDraw on the D2D device
|
|
512
|
+
// context; this has already been done for us by the composition API.
|
|
513
|
+
d2dDeviceContext->DrawTextLayout(
|
|
514
|
+
D2D1::Point2F(
|
|
515
|
+
static_cast<FLOAT>((offset.x) / m_scaleFactor), static_cast<FLOAT>((offset.y) / m_scaleFactor)),
|
|
516
|
+
spTextLayout.get(),
|
|
517
|
+
brush.get(),
|
|
518
|
+
D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
if (drawingSurface) {
|
|
522
|
+
drawingSurface.HorizontalAlignmentRatio(0.0f);
|
|
523
|
+
drawingSurface.VerticalAlignmentRatio(0.0f);
|
|
524
|
+
drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
507
525
|
}
|
|
508
|
-
}
|
|
509
|
-
if (drawingSurface) {
|
|
510
|
-
drawingSurface.HorizontalAlignmentRatio(0.0f);
|
|
511
|
-
drawingSurface.VerticalAlignmentRatio(0.0f);
|
|
512
|
-
drawingSurface.Stretch(winrt::Microsoft::ReactNative::Composition::Experimental::CompositionStretch::None);
|
|
513
|
-
}
|
|
514
526
|
|
|
515
|
-
|
|
516
|
-
|
|
527
|
+
auto &arrowVisual = (region == ScrollbarHitRegion::ArrowFirst) ? m_arrowVisualFirst : m_arrowVisualLast;
|
|
528
|
+
arrowVisual.Brush(drawingSurface);
|
|
529
|
+
}
|
|
517
530
|
}
|
|
518
531
|
|
|
519
532
|
void updateHighlight(ScrollbarHitRegion region) noexcept {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
533
|
+
if (auto outer = m_wkOuter.get()) {
|
|
534
|
+
switch (region) {
|
|
535
|
+
case ScrollbarHitRegion::ArrowFirst:
|
|
536
|
+
case ScrollbarHitRegion::ArrowLast: {
|
|
537
|
+
auto disabled = !std::static_pointer_cast<const facebook::react::ScrollViewProps>(
|
|
538
|
+
winrt::get_self<ScrollViewComponentView>(outer)->viewProps())
|
|
539
|
+
->scrollEnabled;
|
|
540
|
+
drawArrow(region, disabled, m_highlightedRegion == region);
|
|
541
|
+
}
|
|
542
|
+
case ScrollbarHitRegion::Thumb: {
|
|
543
|
+
if (!std::static_pointer_cast<const facebook::react::ScrollViewProps>(
|
|
544
|
+
winrt::get_self<ScrollViewComponentView>(outer)->viewProps())
|
|
545
|
+
->scrollEnabled) {
|
|
546
|
+
m_thumbVisual.Brush(
|
|
547
|
+
winrt::get_self<Theme>(outer.Theme())->InternalPlatformBrush(L"ScrollBarThumbFillDisabled"));
|
|
548
|
+
} else if (m_highlightedRegion == region) {
|
|
549
|
+
m_thumbVisual.Brush(
|
|
550
|
+
winrt::get_self<Theme>(outer.Theme())->InternalPlatformBrush(L"ScrollBarThumbFillPointerOver"));
|
|
551
|
+
} else {
|
|
552
|
+
m_thumbVisual.Brush(winrt::get_self<Theme>(outer.Theme())->InternalPlatformBrush(L"ScrollBarThumbFill"));
|
|
553
|
+
}
|
|
539
554
|
}
|
|
540
555
|
}
|
|
541
556
|
}
|
|
542
557
|
}
|
|
543
558
|
|
|
544
559
|
private:
|
|
545
|
-
winrt::Microsoft::ReactNative::Composition::ScrollViewComponentView
|
|
560
|
+
winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::ScrollViewComponentView> m_wkOuter;
|
|
546
561
|
winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext m_compContext;
|
|
547
562
|
winrt::Microsoft::ReactNative::ReactContext m_reactContext;
|
|
548
563
|
const bool m_vertical;
|
|
@@ -593,8 +608,7 @@ ScrollViewComponentView::ScrollViewComponentView(
|
|
|
593
608
|
compContext,
|
|
594
609
|
tag,
|
|
595
610
|
reactContext,
|
|
596
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
597
|
-
false) {
|
|
611
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {
|
|
598
612
|
// m_element.Content(m_contentPanel);
|
|
599
613
|
|
|
600
614
|
/*
|
|
@@ -895,7 +909,6 @@ void ScrollViewComponentView::OnPointerCaptureLost() noexcept {
|
|
|
895
909
|
}
|
|
896
910
|
|
|
897
911
|
void ScrollViewComponentView::OnKeyDown(
|
|
898
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
899
912
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
900
913
|
switch (args.Key()) {
|
|
901
914
|
case winrt::Windows::System::VirtualKey::End:
|
|
@@ -924,7 +937,7 @@ void ScrollViewComponentView::OnKeyDown(
|
|
|
924
937
|
break;
|
|
925
938
|
}
|
|
926
939
|
|
|
927
|
-
base_type::OnKeyDown(
|
|
940
|
+
base_type::OnKeyDown(args);
|
|
928
941
|
}
|
|
929
942
|
|
|
930
943
|
bool ScrollViewComponentView::scrollToEnd(bool animate) noexcept {
|
|
@@ -72,9 +72,7 @@ struct ScrollInteractionTrackerOwner : public winrt::implements<
|
|
|
72
72
|
facebook::react::LayoutMetrics const &layoutMetrics,
|
|
73
73
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
74
74
|
void prepareForRecycle() noexcept override;
|
|
75
|
-
void OnKeyDown(
|
|
76
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
77
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
75
|
+
void OnKeyDown(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
78
76
|
|
|
79
77
|
void HandleCommand(winrt::hstring commandName, const winrt::Microsoft::ReactNative::IJSValueReader &args) noexcept
|
|
80
78
|
override;
|
|
@@ -33,8 +33,7 @@ SwitchComponentView::SwitchComponentView(
|
|
|
33
33
|
compContext,
|
|
34
34
|
tag,
|
|
35
35
|
reactContext,
|
|
36
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
37
|
-
false) {}
|
|
36
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {}
|
|
38
37
|
|
|
39
38
|
winrt::Microsoft::ReactNative::ComponentView SwitchComponentView::Create(
|
|
40
39
|
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compContext,
|
|
@@ -304,14 +303,13 @@ void SwitchComponentView::OnPointerExited(
|
|
|
304
303
|
}
|
|
305
304
|
|
|
306
305
|
void SwitchComponentView::OnKeyUp(
|
|
307
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
308
306
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
309
307
|
if (args.Key() == winrt::Windows::System::VirtualKey::Space) {
|
|
310
308
|
if (toggle()) {
|
|
311
309
|
args.Handled(true);
|
|
312
310
|
}
|
|
313
311
|
}
|
|
314
|
-
Super::OnKeyUp(
|
|
312
|
+
Super::OnKeyUp(args);
|
|
315
313
|
}
|
|
316
314
|
|
|
317
315
|
bool SwitchComponentView::toggle() noexcept {
|
|
@@ -341,4 +339,18 @@ const facebook::react::SwitchProps &SwitchComponentView::switchProps() const noe
|
|
|
341
339
|
return *std::static_pointer_cast<const facebook::react::SwitchProps>(viewProps());
|
|
342
340
|
}
|
|
343
341
|
|
|
342
|
+
// getToggleState method for IToggleProvider
|
|
343
|
+
ToggleState SwitchComponentView::getToggleState() noexcept {
|
|
344
|
+
if (switchProps().value) {
|
|
345
|
+
return ToggleState::ToggleState_On;
|
|
346
|
+
} else {
|
|
347
|
+
return ToggleState::ToggleState_Off;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// Toggle method for IToggleProvider
|
|
352
|
+
void SwitchComponentView::Toggle() noexcept {
|
|
353
|
+
toggle();
|
|
354
|
+
}
|
|
355
|
+
|
|
344
356
|
} // namespace winrt::Microsoft::ReactNative::Composition::implementation
|
|
@@ -38,9 +38,7 @@ struct SwitchComponentView : SwitchComponentViewT<SwitchComponentView, ViewCompo
|
|
|
38
38
|
facebook::react::LayoutMetrics const &oldLayoutMetrics) noexcept override;
|
|
39
39
|
void FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept override;
|
|
40
40
|
void onThemeChanged() noexcept override;
|
|
41
|
-
void OnKeyUp(
|
|
42
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
43
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
41
|
+
void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
|
|
44
42
|
void OnPointerPressed(
|
|
45
43
|
const winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs &args) noexcept override;
|
|
46
44
|
void OnPointerReleased(
|
|
@@ -59,6 +57,8 @@ struct SwitchComponentView : SwitchComponentViewT<SwitchComponentView, ViewCompo
|
|
|
59
57
|
|
|
60
58
|
static facebook::react::SharedViewProps defaultProps() noexcept;
|
|
61
59
|
const facebook::react::SwitchProps &switchProps() const noexcept;
|
|
60
|
+
ToggleState getToggleState() noexcept override;
|
|
61
|
+
void Toggle() noexcept override;
|
|
62
62
|
winrt::Microsoft::ReactNative::Composition::Experimental::IVisual createVisual() noexcept override;
|
|
63
63
|
|
|
64
64
|
private:
|
package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp
CHANGED
|
@@ -491,8 +491,7 @@ WindowsTextInputComponentView::WindowsTextInputComponentView(
|
|
|
491
491
|
compContext,
|
|
492
492
|
tag,
|
|
493
493
|
reactContext,
|
|
494
|
-
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background
|
|
495
|
-
false) {
|
|
494
|
+
ComponentViewFeatures::Default & ~ComponentViewFeatures::Background) {
|
|
496
495
|
/*
|
|
497
496
|
m_textChangedRevoker =
|
|
498
497
|
m_element.TextChanged(winrt::auto_revoke, [this](auto sender, xaml::Controls::TextChangedEventArgs args) {
|
|
@@ -750,12 +749,11 @@ void WindowsTextInputComponentView::OnPointerMoved(
|
|
|
750
749
|
}
|
|
751
750
|
|
|
752
751
|
void WindowsTextInputComponentView::OnKeyDown(
|
|
753
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
754
752
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
755
753
|
// Do not forward tab keys into the TextInput, since we want that to do the tab loop instead. This aligns with WinUI
|
|
756
754
|
// behavior We do forward Ctrl+Tab to the textinput.
|
|
757
755
|
if (args.Key() != winrt::Windows::System::VirtualKey::Tab ||
|
|
758
|
-
(
|
|
756
|
+
(args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
759
757
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) {
|
|
760
758
|
WPARAM wParam = static_cast<WPARAM>(args.Key());
|
|
761
759
|
LPARAM lParam = 0;
|
|
@@ -776,16 +774,15 @@ void WindowsTextInputComponentView::OnKeyDown(
|
|
|
776
774
|
}
|
|
777
775
|
}
|
|
778
776
|
|
|
779
|
-
Super::OnKeyDown(
|
|
777
|
+
Super::OnKeyDown(args);
|
|
780
778
|
}
|
|
781
779
|
|
|
782
780
|
void WindowsTextInputComponentView::OnKeyUp(
|
|
783
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
784
781
|
const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
|
|
785
782
|
// Do not forward tab keys into the TextInput, since we want that to do the tab loop instead. This aligns with WinUI
|
|
786
783
|
// behavior We do forward Ctrl+Tab to the textinput.
|
|
787
784
|
if (args.Key() != winrt::Windows::System::VirtualKey::Tab ||
|
|
788
|
-
(
|
|
785
|
+
(args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
789
786
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) {
|
|
790
787
|
WPARAM wParam = static_cast<WPARAM>(args.Key());
|
|
791
788
|
LPARAM lParam = 1;
|
|
@@ -807,11 +804,10 @@ void WindowsTextInputComponentView::OnKeyUp(
|
|
|
807
804
|
}
|
|
808
805
|
}
|
|
809
806
|
|
|
810
|
-
Super::OnKeyUp(
|
|
807
|
+
Super::OnKeyUp(args);
|
|
811
808
|
}
|
|
812
809
|
|
|
813
810
|
bool WindowsTextInputComponentView::ShouldSubmit(
|
|
814
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
815
811
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept {
|
|
816
812
|
bool shouldSubmit = true;
|
|
817
813
|
|
|
@@ -824,19 +820,19 @@ bool WindowsTextInputComponentView::ShouldSubmit(
|
|
|
824
820
|
// If 'submitKeyEvents' are supplied, use them to determine whether to emit onSubmitEditing' for either
|
|
825
821
|
// single-line or multi-line TextInput
|
|
826
822
|
if (args.KeyCode() == '\r') {
|
|
827
|
-
bool shiftDown = (
|
|
823
|
+
bool shiftDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
|
|
828
824
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
829
825
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
830
|
-
bool ctrlDown = (
|
|
826
|
+
bool ctrlDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
831
827
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
832
828
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
833
|
-
bool altDown = (
|
|
829
|
+
bool altDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
834
830
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
835
831
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
836
|
-
bool metaDown = (
|
|
832
|
+
bool metaDown = (args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
|
|
837
833
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
838
834
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down ||
|
|
839
|
-
(
|
|
835
|
+
(args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) &
|
|
840
836
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
|
|
841
837
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
|
|
842
838
|
return (submitKeyEvent.shiftKey && shiftDown) || (submitKeyEvent.ctrlKey && ctrlDown) ||
|
|
@@ -854,18 +850,17 @@ bool WindowsTextInputComponentView::ShouldSubmit(
|
|
|
854
850
|
}
|
|
855
851
|
|
|
856
852
|
void WindowsTextInputComponentView::OnCharacterReceived(
|
|
857
|
-
const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
|
|
858
853
|
const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept {
|
|
859
854
|
// Do not forward tab keys into the TextInput, since we want that to do the tab loop instead. This aligns with WinUI
|
|
860
855
|
// behavior We do forward Ctrl+Tab to the textinput.
|
|
861
856
|
if ((args.KeyCode() == '\t') &&
|
|
862
|
-
((
|
|
857
|
+
((args.KeyboardSource().GetKeyState(winrt::Windows::System::VirtualKey::Control) &
|
|
863
858
|
winrt::Microsoft::UI::Input::VirtualKeyStates::Down) != winrt::Microsoft::UI::Input::VirtualKeyStates::Down)) {
|
|
864
859
|
return;
|
|
865
860
|
}
|
|
866
861
|
|
|
867
862
|
// Logic for submit events
|
|
868
|
-
if (ShouldSubmit(
|
|
863
|
+
if (ShouldSubmit(args)) {
|
|
869
864
|
// call onSubmitEditing event
|
|
870
865
|
if (m_eventEmitter && !m_comingFromJS) {
|
|
871
866
|
auto emitter = std::static_pointer_cast<const facebook::react::WindowsTextInputEventEmitter>(m_eventEmitter);
|