mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
do not load data in list if view is opening
This commit is contained in:
@@ -48,6 +48,7 @@ const SimpleList = ({
|
|||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, searchResults, headerTextState} = state;
|
const {colors, searchResults, headerTextState} = state;
|
||||||
const [refreshing, setRefreshing] = useState(false);
|
const [refreshing, setRefreshing] = useState(false);
|
||||||
|
|
||||||
const [dataProvider, setDataProvider] = useState(
|
const [dataProvider, setDataProvider] = useState(
|
||||||
new DataProvider((r1, r2) => {
|
new DataProvider((r1, r2) => {
|
||||||
return r1 !== r2;
|
return r1 !== r2;
|
||||||
@@ -55,7 +56,7 @@ const SimpleList = ({
|
|||||||
);
|
);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
const {width, fontScale,height} = useWindowDimensions();
|
const {width, fontScale, height} = useWindowDimensions();
|
||||||
|
|
||||||
const listData = data;
|
const listData = data;
|
||||||
const dataType = type;
|
const dataType = type;
|
||||||
@@ -67,9 +68,10 @@ const SimpleList = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadData();
|
loadData();
|
||||||
}, [listData, searchResults.results]);
|
}, [data, searchResults.results,loading]);
|
||||||
|
|
||||||
const loadData = () => {
|
const loadData = () => {
|
||||||
|
if (loading) return;
|
||||||
let mainData = [header, {type: 'empty'}];
|
let mainData = [header, {type: 'empty'}];
|
||||||
mainData =
|
mainData =
|
||||||
!listData || listData.length === 0 ? mainData : [header, ...listData];
|
!listData || listData.length === 0 ? mainData : [header, ...listData];
|
||||||
@@ -269,6 +271,7 @@ const SimpleList = ({
|
|||||||
rowRenderer={_renderRow}
|
rowRenderer={_renderRow}
|
||||||
onScroll={_onScroll}
|
onScroll={_onScroll}
|
||||||
canChangeSize={true}
|
canChangeSize={true}
|
||||||
|
optimizeForInsertDeleteAnimations
|
||||||
forceNonDeterministicRendering
|
forceNonDeterministicRendering
|
||||||
renderFooter={() => <View style={{height: 300}} />}
|
renderFooter={() => <View style={{height: 300}} />}
|
||||||
scrollViewProps={{
|
scrollViewProps={{
|
||||||
|
|||||||
Reference in New Issue
Block a user