bug: White flash appearing when switching between tabs on Android
Type: bug
Platform: android 4.4 webview
when switching between tabs ONLY on Android platform, the app show a white flash. This is in 1.0.0 stable. Not using crosswalk. Forum post http://forum.ionicframework.com/t/white-flash-appearing-when-switching-between-tabs-on-android-in-1-0-0-stable/24774
Any word about the status of this issue?
Having same issue. Any updates?
+1
Please provide a minimal example that has this issue.
Just create a new ionic app (tabs template) change the background to any color either then white. build and run on android device (4.4, i'm tested on nexus 5) and you will notice that there is a white flick for few millis on every tab change.
I have found that this is due to ion-header-bar being redefined in each view. I moved ion-header-bar to my main layout template and no longer see the flicker. I believe the default generated project puts the header bar in each view which is why you see it there as well.
the 'ion-header-bar's is automatically generated for me, where (and how) you manually use it ?
So @GentryRiggen you mean the ion-nav-bar?
@mhartington I am using ion-side-menu with a ion-tabs inside of the ion-side-menu-content.
<ion-side-menus>
<ion-side-menu side="left" class="left-side-menu">
<ion-content drag-content="false" overflow-scroll="false" direction="y" delegate-handle="leftMenu">
<div class="list">
<a menu-close class="item item-icon-left" >Something</a>
<a menu-close class="item item-icon-left" >Something</a>
<a menu-close class="item item-icon-left" >Something</a>
</div>
</ion-content>
</ion-side-menu>
<ion-side-menu-content>
<ion-header-bar align-title="center" class="bar-positive">
<button class="button button-icon icon ion-navicon" menu-toggle="left"></button>
<div class="titles">
<h>TITLE</h1>
</div>
</ion-header-bar>
<ion-tabs class="tabs-positive tabs-icon-only dark-background">
<ion-tab>
<ion-nav-view name="tab-1"></ion-nav-view>
</ion-tab>
<ion-tab>
<ion-nav-view name="tab-2"></ion-nav-view>
</ion-tab>
<ion-tab>
<ion-nav-view name="tab-3"></ion-nav-view>
</ion-tab>
</ion-tabs>
</ion-side-menu-content>
</ion-side-menus>
Don't use the ion-header-bar for that, use the ion-nav-bar.
@mhartington Im using the 'ion-nav-bar' and the screen flickering (while moving between tabs)... so how do you suggest to fix it ?
the simple tabs "starter" from ionic built for android shows the flash between navigating and that i believe uses ion-nav-bar.
Hmm, I'm not seeing it in my tests.
https://youtu.be/_ja8a08iSPE
You can see it in the video .. It's the white screen flash when you change tabs.. It appears for just few milliseconds... If you want the see that more clearly change the background color to red, blue or any dark color .
Are you talking about the fading nav bar
He is talking about the white screen (ion-content perimeter) that briefly appears when you switch tabs. You can clearly see it in your video when you switch the first time from "Status" to "Chats". But it actually appears every time.
@mhartington I attached a video form my app (slow motion) you can clearly see it append there. I would like to take a action and help you guys to solve that issue, but I need at least a start point from you.. where should I start ?
youtube link : https://youtu.be/TTuNPlL6Fmg
Thanks.
I've looked at the code and to me the error is in the tabSelected function (ionTab directive) It seems to hide the previous tab before showing the new one.
This dirty hack i've made seem to work. But I'd love to see a proper fix. Just add a timeout around $ionicViewSwitcher.viewEleIsActive(childElement, false);
Line 55025 of ionic.bundle.js
$timeout(function () {
$ionicViewSwitcher.viewEleIsActive(childElement, false);
}, 100);
This is happening to me with:
- Ionic, v1.0.1
- Cordova 5.3.3
I'm running Android 5.1.1 on a Nexus 4.
To reproduce it, I just simply make a "tabs" starter app, change the colour of the navbar to blue (e.g. by changing -stable to -positive) and the flickering becomes obvious. It does actually flicker with the white navbar but you can't see white on white flickering.
I have attempted to add styles to force the transition-time to 0ms on Android and verified that the app has applied these styles to any header item by checking with an attached chrome inspector and inspecting the computed CSS values. I double checked by removing the styles and verifying they went from 0ms to some other number (0.2ms or 0.5ms - and actually about as fast as the flashing effect).
I tried doing @didbarbosa fix but Chrome on the browser and the phone app both complained that $timeout was not defined. When I logged the value of $timeout, it was indeed not defined.
@lloy0076 you need to inject it into the directive
IonicModule
.directive('ionTab', [
'$compile',
'$ionicConfig',
'$ionicBind',
'$ionicViewSwitcher',
'$timeout',
function($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher,$timeout) {