Activity indicator freezes during navigation - nativescript

I'm trying to fix the freezing of activity indicator on android device.
When I navigate from login page to main page, the activity indicator start correctly on login page but then get stuck (still on login page) for few seconds before the main page is finally displayed.
If I delete functions calls on main component startup I still have the problem, so I don't think a worker would solve the problem.
If i delete a bunch of things in the main page HTML file the problem disappears.
What should I do to ? Can I get a worker to load the UI ? Should I divide my main component into few sub-component ?

Related

Navigating to a page causes the app to gets stuck in the current page and exits debug mode automatically

I am working on the Xamarin iOS application and navigating to the login page that is when my app gets stuck in the current page ie the page where i am navigating from.
The debug point don't come to Initialise component of Login page nor it gets logged in catch the app gets stuck for a while and exits debug mode without any errors or exception
This navigation is basic, other pages are being navigated only issue is with the login page.
Also please let me know what parts of code should i Share
Please let me know if there is any solution.
I made a new page and copied all the contents of Login page to the new page and it worked, the underlying issue was the Login Page was corrupted when transferring from Windows To Mac,
As per why i think it was corrupted, because the debug point at Initialize component and onAppearing didn't work at all

Loading a website without browser showing spinning wheel

I am just curious to know how these websites were made to load only once. If you go to the sites http://fueled.com/ or http://ecap.co.nz/, the browser shows the spinning wheel only the first time the website is loaded. When you navigate to other pages from the navigation menu, like About or Contact or Team, when those pages load, the browser doesn't show the spinning wheel.
How do they make them work like this?
It is because page load is not triggered upon those links. Instead, a post request is triggered and its response will be used. Also, further page loads will be quicker, since scripts, styles and pictures will be cached, that is, saved locally on your computer.
You can check what happens using the browser console's network tab. Click on the last request before you click on such a link. You will see that the request log will not be cleared, but other requests are added. That means there is no page load in the meantime.

Too many FB share button request

I'm optimizing my site speed. One of the main issue I'm facing is the homepage.
In the homepage, each article has FB/TW share buttons.
I only inserted the scripts in the footer once but I'm getting bunch of FB/TW share button requests.
Is it normal or there is something I need to do?
For every Like/Share button that you have, your browser needs to make a request to get the content. This is only executed when the browser has received the page from your server, so it does not affect the initial load time.
As CBroe mentions, the button is displayed in an iFrame. These are loaded and depending on your browser settings all at the same time or consecutive. During this time, your browser is not blocked so your used can already interact with the page.
If you want to reduce load, the only option is to remove the buttons. I think you have some index/home page where you load all the articles and for each of those a button? You could consider only showing the buttons on the articles itself, if you are really concerned about this.
But, since this is normal behaviour and your page is not blocked by loading all the iframes, this is not a big issue nor can you optimise it yourself.

How to make navigate between pages faster in windows phone

I'm doing an application on windows phone
I use this method to navigate between pages
NavigationService.Navigate(new Uri("/SecondPage.xaml",UriKind.Relative));
But if I navigate between 2 complex pages (e.g many images on these), the system delay quite a lot of time(2-3s) for navigating
I want to navigate to next page before loading data in second page, when navigating completed then just start loading data for this page
it should be like MARKET PLACE app in PHONE Device, it's so fast
The page constructor and code in the Loaded event handler are executed before the first frame of the page is shown.
So if you want pages to be loaded fast, you should limit long-running operations like loading images in these methods.
One way that you can do this is to override OnNavigatedTo and start long-running operations in this method. OnNavigatedTo is called when a page becomes the active page.

New Instance of the page on Navigation

I have a few pages in an Application that require A-Synchronous calls to be made for about 2-3 minutes to get Synchronized, the user may navigate away from that page during Synchronization and can come back again after visiting multiple pages and the sync continues all the time he is on other pages as well, when I go to a page from sync-page and press the Back button everything works fine.. but when i go to a page and navigate back to sync-page from Application Bar a new Instance of the Page is created and the Sync is just like Re-started.
Now i know every thing is working fine since new instance of a page is created when i call NavigationService.Navigate() , but what should i do in this scenario ? How to get the old instance of a page if it is there ?
Thanks...
You can't get an "old" instance of a page and it's not guaranteed that a backwards navigation will reload the previous instance of the page, it may be a new instance of the same page, but restored to the same state (assuming you saved any).
If you are trying to provide backwards navigation from the application bar then a) you probably shouldn't because that's what the back button is for, and b) you should make sure you use NavigationService.GoBack() instead of NavigationService.Navigate() because Navigate will always launch a new instance of your page.
If the page you want to get to is not the previous page, then it sounds like you are trying to implement non-linear navigation for which there is a recipe on the App Hub.
By the sounds of your scenario, you should handle this long running process separately (away from the view) and then display it's progress or results in a view when the user navigates to the relevant page.

Resources