From e4fcd60462f1a93020eed8302d4b6901c45bfdc1 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Tue, 7 Nov 2023 02:26:01 -0600 Subject: [PATCH 1/4] fix: remove wrong use of createRef --- src/components/InvertedFlatList/index.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/InvertedFlatList/index.js b/src/components/InvertedFlatList/index.js index 7cfa72d9c712..056b1936f7ae 100644 --- a/src/components/InvertedFlatList/index.js +++ b/src/components/InvertedFlatList/index.js @@ -24,7 +24,6 @@ const propTypes = { // It's a HACK alert since FlatList has inverted scrolling on web function InvertedFlatList(props) { const {innerRef, contentContainerStyle} = props; - const listRef = React.createRef(); const lastScrollEvent = useRef(null); const scrollEndTimeout = useRef(null); @@ -32,13 +31,6 @@ function InvertedFlatList(props) { const eventHandler = useRef(null); useEffect(() => { - if (!_.isFunction(innerRef)) { - // eslint-disable-next-line no-param-reassign - innerRef.current = listRef.current; - } else { - innerRef(listRef); - } - return () => { if (scrollEndTimeout.current) { clearTimeout(scrollEndTimeout.current); @@ -48,7 +40,7 @@ function InvertedFlatList(props) { eventHandler.current.remove(); } }; - }, [innerRef, listRef]); + }, [innerRef]); /** * Emits when the scrolling is in progress. Also, @@ -114,7 +106,7 @@ function InvertedFlatList(props) { Date: Tue, 7 Nov 2023 02:34:01 -0600 Subject: [PATCH 2/4] fix: lint and prettier --- src/components/InvertedFlatList/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/InvertedFlatList/index.js b/src/components/InvertedFlatList/index.js index 056b1936f7ae..41ddc1a32636 100644 --- a/src/components/InvertedFlatList/index.js +++ b/src/components/InvertedFlatList/index.js @@ -1,7 +1,6 @@ import PropTypes from 'prop-types'; import React, {forwardRef, useEffect, useRef} from 'react'; import {DeviceEventEmitter, FlatList, StyleSheet} from 'react-native'; -import _ from 'underscore'; import styles from '@styles/styles'; import CONST from '@src/CONST'; import BaseInvertedFlatList from './BaseInvertedFlatList'; @@ -30,8 +29,8 @@ function InvertedFlatList(props) { const updateInProgress = useRef(false); const eventHandler = useRef(null); - useEffect(() => { - return () => { + useEffect( + () => () => { if (scrollEndTimeout.current) { clearTimeout(scrollEndTimeout.current); } @@ -39,8 +38,9 @@ function InvertedFlatList(props) { if (eventHandler.current) { eventHandler.current.remove(); } - }; - }, [innerRef]); + }, + [innerRef], + ); /** * Emits when the scrolling is in progress. Also, From dc2913042933baf733f836593406a0d80583acbc Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Tue, 7 Nov 2023 03:28:42 -0600 Subject: [PATCH 3/4] fix: try to rerun performamce test --- src/components/InvertedFlatList/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/InvertedFlatList/index.js b/src/components/InvertedFlatList/index.js index 41ddc1a32636..8181831c1adf 100644 --- a/src/components/InvertedFlatList/index.js +++ b/src/components/InvertedFlatList/index.js @@ -24,6 +24,7 @@ const propTypes = { function InvertedFlatList(props) { const {innerRef, contentContainerStyle} = props; + const lastScrollEvent = useRef(null); const scrollEndTimeout = useRef(null); const updateInProgress = useRef(false); From a75deb7c3ad54ac2410cf6634b36abeec7d63496 Mon Sep 17 00:00:00 2001 From: s-alves10 Date: Tue, 7 Nov 2023 03:29:08 -0600 Subject: [PATCH 4/4] fix: try to rerun performamce test --- src/components/InvertedFlatList/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/InvertedFlatList/index.js b/src/components/InvertedFlatList/index.js index 8181831c1adf..41ddc1a32636 100644 --- a/src/components/InvertedFlatList/index.js +++ b/src/components/InvertedFlatList/index.js @@ -24,7 +24,6 @@ const propTypes = { function InvertedFlatList(props) { const {innerRef, contentContainerStyle} = props; - const lastScrollEvent = useRef(null); const scrollEndTimeout = useRef(null); const updateInProgress = useRef(false);