Skip to content

Commit

Permalink
Merge pull request Expensify#46353 from bernhardoj/fix/45434-chat-aut…
Browse files Browse the repository at this point in the history
…o-scroll-down-after-editing-money-request-field

Fix chat list in RHP auto scroll down when updating money request fields
  • Loading branch information
aldo-expensify committed Aug 1, 2024
2 parents a3339ef + 908c335 commit e36fcce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/FlatList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ function MVCPFlatList<TItem>({maintainVisibleContentPosition, horizontal = false
mutationObserverRef.current?.disconnect();

const mutationObserver = new MutationObserver(() => {
// When the list is hidden, the size will be 0.
// Ignore the callback if the list is hidden because scrollOffset will always be 0.
if (!getScrollableNode(scrollRef.current)?.clientHeight) {
return;
}

// This needs to execute after scroll events are dispatched, but
// in the same tick to avoid flickering. rAF provides the right timing.
requestAnimationFrame(() => {
Expand Down

0 comments on commit e36fcce

Please sign in to comment.