diff --git a/change/react-native-windows-scrollto-scrollenabled-main.json b/change/react-native-windows-scrollto-scrollenabled-main.json new file mode 100644 index 00000000000..c47de85b716 --- /dev/null +++ b/change/react-native-windows-scrollto-scrollenabled-main.json @@ -0,0 +1 @@ +{"type":"prerelease","dependentChangeType":"patch","email":"collindanielschneide@gmail.com","packageName":"react-native-windows","comment":"Honor programmatic scrollTo when scrollEnabled={false}, matching iOS/Android"} diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp index 2c58e04c42b..17d5e490749 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp @@ -1192,10 +1192,14 @@ void ScrollViewComponentView::HandleCommand(const winrt::Microsoft::ReactNative: } void ScrollViewComponentView::scrollTo(winrt::Windows::Foundation::Numerics::float3 offset, bool animate) noexcept { - if (!std::static_pointer_cast(viewProps())->scrollEnabled) { - return; - } - + // scrollEnabled={false} must only disable *user* scroll gestures, matching + // iOS and Android where setContentOffset / scrollToOffset still work when + // scrolling is disabled. Programmatic scrolls - the scrollTo command, and + // scrollToIndex / scrollToOffset which route through it - previously hit a + // scrollEnabled early-return here and were silently dropped. User-gesture + // input is gated separately (m_scrollVisual.ScrollEnabled, set from + // scrollEnabled in updateProps), so it is safe to always honor a + // programmatic scroll here. m_scrollVisual.TryUpdatePosition(offset, animate); }