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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user