ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: White flash appearing when switching between tabs on Android

Open wonderdogone opened this issue 11 years ago • 121 comments

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

wonderdogone avatar Jun 09 '15 08:06 wonderdogone

Any word about the status of this issue?

ghost avatar Jul 13 '15 12:07 ghost

Having same issue. Any updates?

GentryRiggen avatar Aug 26 '15 22:08 GentryRiggen

+1

hadarge avatar Sep 14 '15 14:09 hadarge

Please provide a minimal example that has this issue.

mhartington avatar Sep 14 '15 14:09 mhartington

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.

hadarge avatar Sep 14 '15 14:09 hadarge

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.

GentryRiggen avatar Sep 14 '15 14:09 GentryRiggen

the 'ion-header-bar's is automatically generated for me, where (and how) you manually use it ?

hadarge avatar Sep 14 '15 14:09 hadarge

So @GentryRiggen you mean the ion-nav-bar?

mhartington avatar Sep 14 '15 14:09 mhartington

@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>

GentryRiggen avatar Sep 14 '15 14:09 GentryRiggen

Don't use the ion-header-bar for that, use the ion-nav-bar.

mhartington avatar Sep 14 '15 14:09 mhartington

@mhartington Im using the 'ion-nav-bar' and the screen flickering (while moving between tabs)... so how do you suggest to fix it ?

hadarge avatar Sep 14 '15 20:09 hadarge

the simple tabs "starter" from ionic built for android shows the flash between navigating and that i believe uses ion-nav-bar.

wonderdogone avatar Sep 14 '15 22:09 wonderdogone

Hmm, I'm not seeing it in my tests.

https://youtu.be/_ja8a08iSPE

mhartington avatar Sep 14 '15 23:09 mhartington

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 .

hadarge avatar Sep 15 '15 11:09 hadarge

Are you talking about the fading nav bar

mhartington avatar Sep 15 '15 13:09 mhartington

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.

didbarbosa avatar Sep 17 '15 17:09 didbarbosa

@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.

hadarge avatar Sep 20 '15 21:09 hadarge

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);

didbarbosa avatar Sep 21 '15 23:09 didbarbosa

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 avatar Sep 25 '15 12:09 lloy0076

@lloy0076 you need to inject it into the directive

IonicModule
.directive('ionTab', [
  '$compile',
  '$ionicConfig',
  '$ionicBind',
  '$ionicViewSwitcher',
  '$timeout',
function($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher,$timeout) {

didbarbosa avatar Sep 25 '15 12:09 didbarbosa