Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16887] TiAPI: Add an event on TabGroup that fires before a Tab is focused

GitHub Issuen/a
TypeNew Feature
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2018-12-12T14:21:54.000+0000
Affected Version/sRelease 3.2.2
Fix Version/sn/a
ComponentsTiAPI
Labelsios
ReporterMarcus Olovsson
AssigneeUnknown
Created2014-04-10T14:41:03.000+0000
Updated2018-12-12T14:21:54.000+0000

Description

I would like to have an event that fires when handleWillShowTab is fired. Currently, the focus-event fires when handleDidShowTab has fired. I would like to do some UI-changes while changing tab, and found that firing an event in handleWillShowTab instead makes it a bit quicker (probably because it's fired before the tab content is rendered?) As a quick fix I created my own event called "willShowTab", as I'm sure there are different use-cases for events just before and after the tab has changed.

Comments

  1. Ritu Agrawal 2014-04-23

    I could not find a reference to handleWillShowTab and handleDidShowTab events. I would appreciate if you can point me to these events in the documentation.
  2. Marcus Olovsson 2014-04-23

    Ah my mistake, it was just a method name I found in TiUITabGroup.m, it seems like it's fired from -(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
  3. Ritu Agrawal 2014-04-24

    Thanks for your clarification. Can you please describe what user action or change should trigger this event at the application level?
  4. Marcus Olovsson 2014-04-24

    Sorry, I'm not sure I understand the question?
  5. Ritu Agrawal 2014-04-24

    It would be great if you can provide a code sample to show how you will use this event to help your use case.
  6. Marcus Olovsson 2014-04-24

    Okay, in my case I use it to change the tintColor of the TabGroup. When using the current focus event, you definitely notice some lag when the tab has changed, since the views inside has to be redrawn as well (I guess). With this new event the tabgroup changes color before redrawing the inner views, which makes the transition between tabs much smoother.
       if (Ti.Platform.osname === "iphone") {
         tabGroup.addEventListener('willShowTab', function(e) {
           tabGroup.tintColor = myTabConfig[e.index].tintColor;
         });
       }
       
  7. Ritu Agrawal 2014-04-28

    Moving this feature request to engineering for further evaluation and prioritization. There may be a better way to achieve the same using current events though.
  8. Samir Mohammed 2018-12-12

    Closing ticket due to the above dialogue. If this is a mistake please feel free to re-open this ticket.

JSON Source