Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tabs): invalid active component detection #11084

Merged
merged 1 commit into from Apr 17, 2017
Merged

Conversation

@soumak77
Copy link
Contributor

soumak77 commented Apr 6, 2017

getComponent() returns a ViewController, so we must reference the
component property when checking against the active component

Ionic Version: 3.x

getComponent() returns a ViewController, so we must reference the
component property when checking against the active component
@soumak77 soumak77 changed the title fix(tabs): invalid component comparision fix(tabs): invalid active component detection Apr 8, 2017
@longzheng

This comment has been minimized.

Copy link

longzheng commented Apr 10, 2017

+1

@ryanemax

This comment has been minimized.

Copy link

ryanemax commented Apr 11, 2017

waiting for merge to master

Copy link

danielalvenstrand left a comment

This clearly fixes the issue, tested and confirmed. No further documentation needed.

Copy link

kabus202 left a comment

Working!

@zhuzhiyu6839

This comment has been minimized.

Copy link

zhuzhiyu6839 commented Apr 13, 2017

@danielalvenstrand
hello The problem is the official?
my ionic versions is 3.0.1
my new construction likewise is this problem, why?

Copy link

vintage left a comment

Applied the change manually to the project, seems to solve the problem with clicking on the active tab. Thanks!

@jgw96 jgw96 merged commit e423e08 into ionic-team:master Apr 17, 2017
@jgw96

This comment has been minimized.

Copy link
Contributor

jgw96 commented Apr 17, 2017

Thanks, @soumak77 ! Great first contribution to Ionic!

flivni added a commit to flivni/ionic that referenced this pull request Apr 21, 2017
getComponent() returns a ViewController, so we must reference the
component property when checking against the active component
@pixelone

This comment has been minimized.

Copy link

pixelone commented Apr 26, 2017

How can we apply this fix now (e.g manually)? This actually causes a black screen for me. (e.g If you double tap the same tab icon real fast and multiple times. Eventually after about 20 times I then get a black screen and the view is lost.

Cordova CLI: 6.5.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v7.8.0
Xcode version: Xcode 8.3.2 Build version 8E2002

@kabus202

This comment has been minimized.

Copy link

kabus202 commented Apr 27, 2017

@kamok

This comment has been minimized.

Copy link

kamok commented May 17, 2017

Hey guys, can you explain what this patch fixes? I'm having an issue where clicking the active tab will create a new instance of the page instead of doing nothing. Is that what this fixes? I don't want to upgrade before knowing because upgrading usually breaks some tests.

@soumak77

This comment has been minimized.

Copy link
Contributor Author

soumak77 commented May 17, 2017

@kamok The code was not properly checking the active tab. This caused the tab to be reloaded every time even if it was already active.

@sourcebits-jayaprakash

This comment has been minimized.

Copy link

sourcebits-jayaprakash commented Sep 11, 2017

@kamok,
I have similar issue, I navigate to the child pages from the main tab page(root page) but later when I click on the tab twice the view controller is not resetting to the main tab page(root page). Can you please let me know how to reset the navigation from different child pages on double tap to display root page of the current clicked tab ?
Below is my code:
import { Component } from '@angular/core';

import { NavParams, NavController, Nav } from 'ionic-angular';
import { Tabs } from "ionic-angular/navigation/nav-interfaces";

@component({
templateUrl: 'tabs.html'
})
export class TabsPage {
nav: NavController;
// set the root pages for each tab
tab1Root: any = Root1Page;
tab2Root: any = Root2Page;
tab3Root: any = Root3Page;
tab4Root: any = Root4Page;
tab5Root: any = Root5Page;
mySelectedIndex: number;

constructor(navParams: NavParams, nav:NavController) {
this.mySelectedIndex = navParams.data.tabIndex || 0;
}
}

BELOW IS TABS.HTML
<ion-tabs [selectedIndex]="mySelectedIndex">
<ion-tab [root]="tab1Root" tabTitle="Meetings" tabIcon="meeting">
<ion-tab [root]="tab4Root" tabTitle="Agenda" tabIcon="speakers-icon">
<ion-tab [root]="tab3Root" tabTitle="Attendees" tabIcon="attendees">
<ion-tab [root]="tab2Root" tabTitle="Speakers" tabIcon="agenda">
<ion-tab [root]="tab5Root" tabTitle="Profile" tabIcon="profile">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.