From 7441f46dc7b6ffff70e250bfaab610df84ddef23 Mon Sep 17 00:00:00 2001 From: balzack Date: Tue, 4 Oct 2022 20:45:53 -0700 Subject: [PATCH] avoid latch during momentum --- app/mobile/src/session/conversation/Conversation.jsx | 8 ++++++-- .../src/session/conversation/useConversation.hook.js | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/app/mobile/src/session/conversation/Conversation.jsx b/app/mobile/src/session/conversation/Conversation.jsx index bc18870e..03d8fac5 100644 --- a/app/mobile/src/session/conversation/Conversation.jsx +++ b/app/mobile/src/session/conversation/Conversation.jsx @@ -43,8 +43,10 @@ export function ConversationBody() { const ref = useRef(); const latch = () => { - actions.latch(); - ref.current.scrollToIndex({ animated: true, index: 0 }); + if (!state.momentum) { + actions.latch(); + ref.current.scrollToIndex({ animated: true, index: 0 }); + } } return ( @@ -52,6 +54,8 @@ export function ConversationBody() { { updateState({ latched: false }); }, + setMomentum: () => { + updateState({ momentum: true }); + }, + clearMomentum: () => { + updateState({ momentum: false }); + }, }; return { state, actions };