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

viewWillEnter is not triggered on App instance when switching between tabs #11752

Closed
stalniy opened this issue May 22, 2017 · 2 comments
Closed

Comments

@stalniy
Copy link
Contributor

stalniy commented May 22, 2017

Ionic version: (check one with "x")
[ ] 1.x (For Ionic 1.x issues, please use https://github.com/driftyco/ionic-v1)
[x] 2.x
[x] 3.x

I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When switching between tabs in ion-tabs ionic emits value on viewWillEnter observable on App instance only once (when component is created and doesn't emit for subsequent navigations)

Expected behavior:
When switching between tabs in ion-tabs ionic emits viewWillEnter observable on App instance

Steps to reproduce:

  1. Create an ionic app with tabs
  2. Inject App and subscribe to viewWillEnter
  3. Navigate between tabs

Other information:
issue caused by this line https://github.com/driftyco/ionic/blob/master/src/components/tabs/tabs.ts#L383

I think to fix the issue the line should be changed to:

selectedPage && selectedTab._willEnter(selectedPage);

The same should be done for other leave/enter events.
The fix is quite important for properly and easily tracking analytics in the whole application because it allows to track all navigation events through subscription to Apps viewWillEnter observable.
I'm ready to create PR if you think the suggested approach is correct

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 7.0.1 
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
ios-deploy version: 1.9.0 
ios-sim version: 5.0.8 
OS: OS X El Capitan
Node Version: v6.9.1
Xcode version: Xcode 8.2.1 Build version 8C1002
@jgw96
Copy link
Contributor

jgw96 commented May 22, 2017

Hello, thanks for using Ionic! I am going to close this issue as a duplicate of #11694 and we can continue the discussion on that issue 😃 .

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 2, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants