Skip to content

Commit 32ecb8d

Browse files
committed
fix: Fix ChangedView raised too early
1 parent a5392e6 commit 32ecb8d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.wasm.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,18 @@ public void ScrollTo(double? horizontalOffset, double? verticalOffset, bool disa
216216
rootFwElt.LayoutUpdated += TryProcessScrollTo;
217217
}
218218

219-
// As the native ScrollTo is going to be async, we manually raise the event with the provided values.
220-
// If those values are invalid, the browser will raise the final event anyway.
221-
(TemplatedParent as ScrollViewer)?.OnScrollInternal(
222-
horizontalOffset ?? GetNativeHorizontalOffset(),
223-
verticalOffset ?? GetNativeVerticalOffset(),
224-
isIntermediate: false
225-
);
219+
if (disableAnimation)
220+
{
221+
// As the native ScrollTo is going to be async, we manually raise the event with the provided values.
222+
// If those values are invalid, the browser will raise the final event anyway.
223+
// Note: If the caller has allowed animation, we assume that it's not interested by a sync response,
224+
// we prefer to wait for the browser to effectively scroll.
225+
(TemplatedParent as ScrollViewer)?.OnScrollInternal(
226+
horizontalOffset ?? GetNativeHorizontalOffset(),
227+
verticalOffset ?? GetNativeVerticalOffset(),
228+
isIntermediate: false
229+
);
230+
}
226231
}
227232
}
228233

0 commit comments

Comments
 (0)