ion-nav-bar inside ion-nav-view to apply the animation also on the nav-bar
Hi guys,
I was wondering if there is a way to include the ion-nav-bar inside the ion-nav-view, with that, developers will be able to apply the animation on the nav-bar also. We can see this kind of animations between transitions on several well known apps (twitter for android v.5.7.0, facebook messenger for android, etc..). The nav-bar is always included inside the transition, not only the content.
I made a codepen with my attempt to do it: http://codepen.io/anon/pen/ogJBa
And this one http://codepen.io/anon/pen/JGgIh to show how weird it could be if the nav-bar on a view is not displayed.
thanks for your answer :smile: :beers:
Did you try adding an animation class to the navbar itself?
http://ionicframework.com/docs/api/directive/ionNavBar/ recommends 'nav-title-slide-ios7'
I thought the animation in the nav bar was only for the title and the buttons, not the bar itself. I have to try this. But I am not sure about the render of the animation because there is a scale notion.
It works if I am using a basic header instead of ion-nav-bar inside the ion-view, cf that codepen: http://codepen.io/anon/pen/zGDwC
I see what you mean ... you want to animate the whole navbar every view change?
basically, I want to animate the whole view (header, footer, content). The animation that I reproduced here (http://codepen.io/anon/pen/zGDwC for the demo) is used in a lot of apps. I know that my request looks like I am picky but I really think that is a must have if we want to have a native look n feel.
your current implement is very iOS centric (I just checked on my coworker's iPhone 5 - twitter app).
what do you think?
OK, added one thing to let you do this!
Now you can put an ion-nav-bar inside each individual ion-view:
<script id="view1.html" type="text/ng-template">
<ion-nav-bar class="bar-positive">
<ion-nav-back-button>Back</ion-nav-back-button>
</ion-nav-bar>
<ion-view title="view1"></ion-view>
</script>
<script id="view2.html" type="text/ng-template">
<ion-nav-bar class="bar-positive">
<ion-nav-back-button>Back</ion-nav-back-button>
</ion-nav-bar>
<ion-view title="view2"></ion-view>
</script>
Check the docs when the travis build finishes for a full explanation: http://ionicframework.com/docs/nightly/api/directive/ionNavBar
Note that you don't want an animation class on the navbar if you do this.
Please test it out heavily in your app and let me know any problems; this addition is pretty experimental.
Thanks I will try this out by this weekend!
As far as I've tested, it is working well. Tested on my android device and on the iOS simulator. I don't have any iOS devices here to test.
I tested in iOS 7.1 and the functionality it's working well except a withe vertical 1px line between views using <body ng-app="starter" animation="slide-left-right-ios7">
@gastonbesada do you have anymore information? Could you post a plnkr/codepen to reproduce this?
@gatonbesada bump :-) Any more informatino about this 1px line problem?
@ajoslin Here is the cp: http://codepen.io/gastonbesada/pen/ctFdD
I rewrite the transition time to help to see it.
Thanks
Oh @ajoslin , I saw, I had the nav-bar inside of nav-view. Now I moved it outside and when the nav-bar is blurred in/out, I see the pane background (white).
Your codepen will work if you take out the nav-title-slide-ios7 attribute. you don't need it anymore, since the parent page will be causing the navbar to animate.
I removed nav-title-slide-ios7and now I see the 1px vertical line in the nav-bar.
http://codepen.io/gastonbesada/pen/ctFdD
Fixed by removing the border rule from the bar. Not sure why it's there - I'll make sure it's not useful and push if so.
Found the source, fixed.
I'm having some problems with the ionNavBackButton when I put the ion-nav-bar inside each ion-view.
After some debugging it seems to me that when the ion-nav-bar is placed inside of each individual ion-view, the navigation history is not registered unless there is an ionNavBackButton in the ion-nav-bar. And therefore the back button is hidden until you visit your 2nd view containing a back button.
Here are two codepens to demonstrate:
- Here back-buttons are placed in each view: http://codepen.io/ooystein/pen/dlgGH
- In this example the back-button in the first view(Home) is removed, and it prevents the back button in the other views from showing up on the first visit: http://codepen.io/ooystein/pen/CLfFj
Is this a bug, or am I using it wrong? The codepen example is probably not good at illustrating the need for this functionality since you probably don't want a back button on pages in the menu anyway. But it demonstrates the problem.
Im having the same problem as you @ooystein - did you find any solution?
No. I reverted to using the navbar the standard way.