Skip to content

Commit 208cc0f

Browse files
author
Nitin Chaudhary
committed
Fix snapToInterval type - Float not optional
1 parent 51748cb commit 208cc0f

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -467,28 +467,30 @@ struct ScrollBarComponent {
467467
}
468468

469469
winrt::com_ptr<IDWriteTextFormat> spTextFormat;
470-
winrt::check_hresult(::Microsoft::ReactNative::DWriteFactory()->CreateTextFormat(
471-
L"Segoe Fluent Icons",
472-
nullptr, // Font collection (nullptr sets it to use the system font collection).
473-
DWRITE_FONT_WEIGHT_REGULAR,
474-
DWRITE_FONT_STYLE_NORMAL,
475-
DWRITE_FONT_STRETCH_NORMAL,
476-
8, // Xaml resource: ScrollBarButtonArrowIconFontSize
477-
L"",
478-
spTextFormat.put()));
470+
winrt::check_hresult(
471+
::Microsoft::ReactNative::DWriteFactory()->CreateTextFormat(
472+
L"Segoe Fluent Icons",
473+
nullptr, // Font collection (nullptr sets it to use the system font collection).
474+
DWRITE_FONT_WEIGHT_REGULAR,
475+
DWRITE_FONT_STYLE_NORMAL,
476+
DWRITE_FONT_STRETCH_NORMAL,
477+
8, // Xaml resource: ScrollBarButtonArrowIconFontSize
478+
L"",
479+
spTextFormat.put()));
479480

480481
winrt::check_hresult(spTextFormat->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER));
481482

482483
winrt::com_ptr<IDWriteTextLayout> spTextLayout;
483-
winrt::check_hresult(::Microsoft::ReactNative::DWriteFactory()->CreateTextLayout(
484-
m_vertical ? ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDDB" : L"\uEDDC")
485-
: ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDD9" : L"\uEDDA"),
486-
1, // The length of the string.
487-
spTextFormat.get(), // The text format to apply to the string (contains font information, etc).
488-
(m_arrowSize / m_scaleFactor), // The width of the layout box.
489-
(m_arrowSize / m_scaleFactor), // The height of the layout box.
490-
spTextLayout.put() // The IDWriteTextLayout interface pointer.
491-
));
484+
winrt::check_hresult(
485+
::Microsoft::ReactNative::DWriteFactory()->CreateTextLayout(
486+
m_vertical ? ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDDB" : L"\uEDDC")
487+
: ((region == ScrollbarHitRegion::ArrowFirst) ? L"\uEDD9" : L"\uEDDA"),
488+
1, // The length of the string.
489+
spTextFormat.get(), // The text format to apply to the string (contains font information, etc).
490+
(m_arrowSize / m_scaleFactor), // The width of the layout box.
491+
(m_arrowSize / m_scaleFactor), // The height of the layout box.
492+
spTextLayout.put() // The IDWriteTextLayout interface pointer.
493+
));
492494

493495
POINT offset;
494496
{
@@ -820,7 +822,7 @@ void ScrollViewComponentView::updateProps(
820822
}
821823

822824
if (!oldProps || oldViewProps.snapToInterval != newViewProps.snapToInterval) {
823-
m_scrollVisual.SnapToInterval(static_cast<float>(newViewProps.snapToInterval.value_or(0.0)));
825+
m_scrollVisual.SnapToInterval(static_cast<float>(newViewProps.snapToInterval));
824826
}
825827

826828
if (!oldProps || oldViewProps.snapToAlignment != newViewProps.snapToAlignment) {

0 commit comments

Comments
 (0)