optimize screen loading

This commit is contained in:
ammarahm-ed
2021-04-09 10:42:50 +05:00
parent ddfb5ec2f0
commit 597f5417c1
4 changed files with 6 additions and 8 deletions

View File

@@ -6,6 +6,8 @@ import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
import {useTracked} from '../../provider';
import {DDS} from '../../services/DeviceDetection';
import {eSendEvent} from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import SettingsService from '../../services/SettingsService';
import Sync from '../../services/Sync';
import {dHeight} from '../../utils';
import {eScrollEvent} from '../../utils/Events';
@@ -69,14 +71,10 @@ const SimpleList = ({
setLoading(false);
setTimeout(() => {
setLoaded(true)
},50);
},Navigation.getCurrentScreen() === SettingsService.get().homepage ? 1000 : 150);
}
}, [listData, deviceMode, loading]);
useEffect(() => {
console.log("rerendering");
})
const _onRefresh = async () => {
await Sync.run();
if (refreshCallback) {

View File

@@ -11,7 +11,7 @@ import {tabBarRef} from './Refs';
import {SIZE} from './SizeUtils';
export const InteractionManager = {
runAfterInteractions: (func, time = 150) => setTimeout(func, time),
runAfterInteractions: (func, time = 10) => setTimeout(func, time),
};
export const APP_VERSION = 1350;

View File

@@ -26,7 +26,7 @@ export const Notebook = ({route, navigation}) => {
let ranAfterInteractions = false;
const runAfterInteractions = (time = 150) => {
const runAfterInteractions = (time = 10) => {
InteractionManager.runAfterInteractions(() => {
let notebook = db.notebooks.notebook(params.notebook?.id).data;
params.notebook = notebook;

View File

@@ -32,7 +32,7 @@ export const Notes = ({route, navigation}) => {
let pageIsLoaded = false;
let ranAfterInteractions = false;
const runAfterInteractions = (time = 150) => {
const runAfterInteractions = (time = 10) => {
InteractionManager.runAfterInteractions(() => {
Navigation.routeNeedsUpdate('NotesPage', () => {
init();