Skip to content

Commit

Permalink
fix: Fix ChangedView raised too early
Browse files Browse the repository at this point in the history
  • Loading branch information
dr1rrb committed Jun 2, 2021
1 parent a5392e6 commit 32ecb8d
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,18 @@ public void ScrollTo(double? horizontalOffset, double? verticalOffset, bool disa
rootFwElt.LayoutUpdated += TryProcessScrollTo;
}

// As the native ScrollTo is going to be async, we manually raise the event with the provided values.
// If those values are invalid, the browser will raise the final event anyway.
(TemplatedParent as ScrollViewer)?.OnScrollInternal(
horizontalOffset ?? GetNativeHorizontalOffset(),
verticalOffset ?? GetNativeVerticalOffset(),
isIntermediate: false
);
if (disableAnimation)
{
// As the native ScrollTo is going to be async, we manually raise the event with the provided values.
// If those values are invalid, the browser will raise the final event anyway.
// Note: If the caller has allowed animation, we assume that it's not interested by a sync response,
// we prefer to wait for the browser to effectively scroll.
(TemplatedParent as ScrollViewer)?.OnScrollInternal(
horizontalOffset ?? GetNativeHorizontalOffset(),
verticalOffset ?? GetNativeVerticalOffset(),
isIntermediate: false
);
}
}
}

Expand Down

0 comments on commit 32ecb8d

Please sign in to comment.