Skip to content

Commit

Permalink
fix console log error
Browse files Browse the repository at this point in the history
  • Loading branch information
dukenv0307 committed Feb 27, 2024
1 parent d2a9c6f commit 76a1f30
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 76a1f30

Please sign in to comment.