The docs say there is an f7-push transition and shows to use it as
And later it suggests using the “router-transition-[name]-backward” so we’re assuming that since f7-push is a built-in transition then “router-transition-f7-push-backward” would work.
Since f7-push seems to be the default and that is actually preferred for this app when navigating away from ‘/’ to any other page but when navigating from any other page back to ‘/’ home we want the transition to be backward.
But I’m not getting the page transition to go backwards. What’s the trick to this?
I think the issue is how you’re using router.navigate within an “async” route method… That does not look normal to me. The async route is designed to either call “resolve” or “reject” to handle what happens to the already requested route…
You use “reject” but then you FORWARD navigate to welcome, home or on boarding… You should be using the “resolve” method and then put in your your componentURL or your URL in that as a parameter.
Notice that on all of your if statements you are not stopping them (ie: rejecting) so you should not use the “reject” function if I am reading your intent properly. Also… I am guessing on the “url” part of the resolve function. You didn’t post your whole routes file so I can’t tell if you are using plain html files or components to use “componentUrl: ‘home.html’” for example.
In my apps the reject is only ever used to stop someone from navigating (back or forward) to a specific page unless they have the right password or clearance to do so.
Try using the resolve function and let us know if it solved the issue you were having!
My “issue” is that it’s REALLY bad coding practice to define the same data in more than one place so I was trying to use the /path/ associated with ‘home’ and let the router do the lookups so that way if the page associated with /home/ ever gets changed, it only has to be changed in one place. Now /home/, /onboarding/ and /welcome/ all have two places. I think async needs a ‘path’ in addition to all the other methods.
I hear you on the issue of bad coding practices but I think there are many solutions to that statement that are up to the programmer, not the framework/library/tool/etc… For example I use webpack on v5 and import my component pages so I have a variable at the top of my routes file that links to the filename. If you did that then the filename would only be written in one spot. I am not saying that is the solution for you just something you can do.
In the way you want to do it… Have you looked at the “redirect” function? It looks like it would allow you to do what you wanted by passing in the route url instead of the filename for each…
I hadn’t found redirect. When I first posted the question about rerouting the home page to a login/welcome-back/onboarding page I was given two options. @nolimits4web suggested one that worked well on app init but I couldn’t figure out how to get it to work for situations like when a user was logged out. Then @pvtallulah gave me his solution using async() but I struggled to get that to work. Before I added the reject(), after you had navigated back to the home page from welcome or onboarding then F7 stopped redrawing the new page and reject fixed that.
After 7 years of JQuery Mobile, right now, I’m still experimenting with kitchen-sink (core) and figuring out how many ways I can break it before I get what I need to work. LOL Some things have been surprisingly easy to do while other things are like pulling teeth. Some of its new architecture blues, some are me trying to do it the way I’m used to and some are just plain hard to do. The good news is that lots of people like you have figured out cool ways to do most things and are quite helpful…
Now let me try redirect: for the rest of the day and then tomorrow I’ll post about the problem I’m having with icons in the menu. Again, thanks for your help!
NOTE: The redirect worked perfectly as well. Even better actually as I could use the component mapping.