Nativescript: Where to store navigation? - nativescript

Using Nativescript, where is the navigation in the SideDrawer stored? Should it be stored in application settings as a json string, or just loaded with an api call everytime it's needed?

every time you call $navigateTo or similar navigation strategy, you generate a kind of navigation entry (varying depending of your nativescript flavour) and this is used to tell to where back button should go if pressed.
Please note you might set clearHistory in order to take rid of the navigation entries stack.

If you use a Frame (Core / Vue) / page-router-outlet (Angular) as root for drawer content, the navigation history should be taken care by default.
Hitting the back button will automatically take you to previous page on the topmost frame's navigation stack.

Related

In Flutter, how to create an UI like Uber to have map in middle and AppBar and navigate to different type of views

I am pretty new to Flutter. I am working on a project to create an UI like Uber to have google map in the background and have different type of views, such as full screen address input view(it seems full screen but part of the view can be hidden to expose the map behind and interact with it), persistent bottom sheets and some floating button on top. Using stack to put one bottom sheet on the map is not difficult. But when it comes to navigate back and forth between different type of views while keeping the map in the background and the map is still touchable, I am not sure how to manage it. Sometimes it navigate 2-3 times deep and back to the first bottom sheet. So the question is:
How to implement a way to navigate between different type of views, like firstly pull up full screen address view, pop the address view after entering address and pull up car type view as the sample image shown on the link below. And press on the back button on top left corner will go back to address view.
If you have any idea how to design this navigation flow, please share it. Thank you.
Sample image
Update: found this GitHub repository demonstrating how to implement Uber like UI. I am checking it out.
https://github.com/iamSahdeep/fu_uber
For background maps with elements on top, a Stack is best as you mentioned.
For persistent bottom sheets, use the BottomSheet class
For the floating button, use the FloatingActionButton class
For the navigation between BottomSheets only, you might want to learn more about this plugin Modal Bottom Sheet. It has exactly what you need. Check the "Cupertino Modal with inside Navigation".

Animating page navigation in WP 8.1 while the current page stays still

In WP 8.1 Store app, how can I change page animation upon navigating to another page within the frame such that the current page stays still while the new page is animating on top of it by moving from the top of the screen to the bottom?
I'm currently animating my navigation like so:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
Frame.ContentTransitions = new TransitionCollection
{
new PaneThemeTransition{Edge = EdgeTransitionLocation.Top}
};
}
But this is animating both pages by moving the current one from bottom to top while the second one simultaneously moves from top to bottom. I'm also seeing a black background while the pages are moving for screen area that's not occupied by any content.
You unfortunately can not navigate to a different page and keep the previous page visible during the animation. That is why all page Transitions right now only support an In-Transition and an Out-Transition. We discussed the issue with Microsoft developers during this years //Build so I'm certain of this information.
If you really need that effect you can perhaps achieve it using a workaround. Instead of placing your content on separate pages you would create user controls and animate those while staying on a single page. This however can be a little tricky due to you manually having to manage "navigation" between the user controls instead of having the system deal with it for regular pages.
More information on how to implement animations in Windows Phone Silverlight Apps can be found in this article: http://msdn.microsoft.com/en-us/library/windows/apps/jj206955%28v=vs.105%29.aspx
I had a similar problem a while ago and it is kind of a workaround as well but it might do the trick for you.
You can place a Frame object taking all the available space on your current page. Then, instead of navigating from your current Page Frame, you navigate from the Frame object you put on top of your actual page.
The problem with this approach is that you would really "get rid" of the first page.
But this can work for you, or at least give you another insight of the problem.

Flex Components are not getting refreshed

Hi We are using Flex 4 in our project on UI side. On loading the application dashboard, we get a set of pods. We click on a pod and the pod view opens. This pod view contains datagrid with the first column as a hyperlink. When you click on hyperlink another screen opens which is our module screen.
This module screen has a SUBMIT button on top and a couple of datagrids. Now we load data in the grids using RemoteObject. The parent container for each of the grid is a WindowShade Component.
Now our requirement is that the user can make modifications in one or both of the grids and click SUBMIT. Depending upon which grid the user has modified I want to make the corresponding Window shade as read only. IF the user modifies both the grids, I need to make both the Window Shade components as read only and disable the SUBMIT button. The user should be able to see this change immediately on click of SUBMIT without closing the screen or navigating away from the screen.
When the user opens screen for the first time, we get some statuses from backend and Depending upon these statuses, I make the Window shades as read only and enable/disable the buttons. When I click SUBMIT, I still hit the backend and get the status but no enabling/disabling of buttons or window shade happens.
I have written the logic for enabling/disabling in the updateComplete method of my mxml file for which swf is created.
the updateComplete gets called when user opens screen for the first time.It does not get called when the user clicks SUBMIT. why is it so?
I have tried using Loader and SWFLoader to load my SWF file as below but it is not working either.
var request:URLRequest = new URLRequest("com/citi/risk/credit/maintenance/view/widgets/CRCMaintenanceModule.swf");
var loader:Loader = new Loader();
loader.load(request);
Any help or pointers would be greatly appreciated.
Two things you may want to consider:
1) In short, FlexEvent.UPDATE_COMPLETE is an event that gets dispatched has completed rendering itself (gone through a Flex component life cycle). This could happen once, or many times depending on how often the component changes and it's state needs to be re-rendered.
The frequency/timing of this event will vary based on the object that is dispatching it. For example a container that is being resized will dispatch this numerous time. A label that never changes may only do it once.
Instead, you should consider adding a "creationComplete" (FlexEvent.CREATION_COMPLETE) event listener. "creationComplete" only happens once, you can add the listener to any object that contains the submit button.
2) When you click submit, the object you've added the "updateComplete" listener to probably hasn't changed enough to go through Flex's component life cycle. So no event is dispatched.
The answer to why this doesn't happen actually depends on which object you have added the event listener to.
Have you tried using a "click" handler on the submit button, so you could disable the appropriate elements when the button is clicked? Again, the "click" event will happen only once, unlike "updateComplete" ;)

WebBrowserControl uninitialized when coming back from sub screen

i have a page with a WebBrowserControl + some buttons at the bottom. When i click on of the buttons, a subpage is opened (NavigationService.Navigate(...)).
Now, when i'm on the sub page and close that page via NavigationService.GoBack() the WebBrowserControl is just white. Seems like it is completely uninitialized. Also checking WebBrowserControl.Sourcegives null.
Any ideas?
In a case like this you would want to make sure you are keeping track of objects in isolated storage or known as TombStoning on the WP7.
you would want to save page state onNavigatingFrom() and Load it onNavigationTo().
That should work. :)

Which is better, some grids collapsed or some user controls?

I'm developing a Windows Phone 7 application that uses some Transient content.
To avoid to go back to that transient content I've decided to use a phew page with several grids on the same page.
When I have to show another "page" I set to collapsed current grid and then I set to visible desired grid.
I know this can be done using user control, but I'm not sure if using user controls can be slowest that using Grids. Any advice?
And another question is if I use grids, how can I use page transitions?
Another option for when you want to show transient content is to use a Popup control. This won't appear in the navigation stack, so when a user goes back (<-) they won't see this content.
However, Popup content isnt GPU accelerated, so you only want to display simple content, no animations etc...
If you want page transitions etc... then i think your only option is to use Pages. That way you can do the transitions and the back button works as expected.
It doesn't matter if you do this via user controls or grids - what matters speed wise is the complexity of your layout.
A user control may be better if you are doing this on a number of pages so you don't repeat yourself.
One way to do page transitions is to do it with stack panels. Have the second "hidden" stack panel way off to the right so it is off screen then animate it in.

Resources