From cd2d866d0e966ffcbfb4c2bf153130d33c9d154f Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Wed, 30 Dec 2020 21:06:14 +0500 Subject: [PATCH] do not load data in list if view is opening --- apps/mobile/src/components/SimpleList/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js index 13e27f5e0..c53fad1bf 100644 --- a/apps/mobile/src/components/SimpleList/index.js +++ b/apps/mobile/src/components/SimpleList/index.js @@ -48,6 +48,7 @@ const SimpleList = ({ const [state, dispatch] = useTracked(); const {colors, searchResults, headerTextState} = state; const [refreshing, setRefreshing] = useState(false); + const [dataProvider, setDataProvider] = useState( new DataProvider((r1, r2) => { return r1 !== r2; @@ -55,7 +56,7 @@ const SimpleList = ({ ); const insets = useSafeAreaInsets(); - const {width, fontScale,height} = useWindowDimensions(); + const {width, fontScale, height} = useWindowDimensions(); const listData = data; const dataType = type; @@ -67,9 +68,10 @@ const SimpleList = ({ useEffect(() => { loadData(); - }, [listData, searchResults.results]); + }, [data, searchResults.results,loading]); const loadData = () => { + if (loading) return; let mainData = [header, {type: 'empty'}]; mainData = !listData || listData.length === 0 ? mainData : [header, ...listData]; @@ -269,6 +271,7 @@ const SimpleList = ({ rowRenderer={_renderRow} onScroll={_onScroll} canChangeSize={true} + optimizeForInsertDeleteAnimations forceNonDeterministicRendering renderFooter={() => } scrollViewProps={{