fix(app): keep streamed chat position stable on Android

Ignore synthetic momentum-end events emitted after native anchor corrections. Only active user momentum may settle sticky-bottom intent.
This commit is contained in:
Mohamed Boudra
2026-07-26 20:47:25 +02:00
parent e859d2df12
commit 72c7d3fe3e
@@ -359,6 +359,11 @@ function NativeStreamViewport(props: StreamRenderInput & { strategy: StreamStrat
const handleMomentumScrollEnd = useStableEvent( const handleMomentumScrollEnd = useStableEvent(
(event: NativeSyntheticEvent<NativeScrollEvent>) => { (event: NativeSyntheticEvent<NativeScrollEvent>) => {
// Android can emit momentum-end after a programmatic anchor correction.
// Only momentum that still owns the user gesture may settle scroll intent.
if (!isUserScrollActiveRef.current) {
return;
}
const isNearBottom = isScrollEventNearBottom(event); const isNearBottom = isScrollEventNearBottom(event);
clearPendingUserScrollEnd(); clearPendingUserScrollEnd();
isUserScrollActiveRef.current = false; isUserScrollActiveRef.current = false;