Skip to content

Commit

Permalink
Merge pull request #37261 from dukenv0307/fix/37253-console-error-sho…
Browse files Browse the repository at this point in the history
…w-up

Fix/37253: Console log error when opening thread

(cherry picked from commit a13a69d)
  • Loading branch information
techievivek authored and OSBotify committed Feb 27, 2024
1 parent caf5adf commit 2adde5e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/FlatList/MVCPFlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const MVCPFlatList = React.forwardRef(({maintainVisibleContentPosition, horizont
const firstVisibleViewRef = React.useRef(null);
const mutationObserverRef = React.useRef(null);
const lastScrollOffsetRef = React.useRef(0);
const isListRenderedRef = React.useRef(false);

const getScrollOffset = React.useCallback(() => {
if (scrollRef.current == null) {
Expand Down Expand Up @@ -137,6 +138,9 @@ const MVCPFlatList = React.forwardRef(({maintainVisibleContentPosition, horizont
}, [adjustForMaintainVisibleContentPosition, getContentView, getScrollOffset, scrollToOffset]);

React.useEffect(() => {
if (!isListRenderedRef.current) {
return;
}
requestAnimationFrame(() => {
prepareForMaintainVisibleContentPosition();
setupMutationObserver();
Expand Down Expand Up @@ -186,6 +190,10 @@ const MVCPFlatList = React.forwardRef(({maintainVisibleContentPosition, horizont
onScroll={onScrollInternal}
scrollEventThrottle={1}
ref={onRef}
onLayout={(e) => {
isListRenderedRef.current = true;
props.onLayout?.(e);
}}
/>
);
});
Expand Down

0 comments on commit 2adde5e

Please sign in to comment.