Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20157] iOS: Support for `selected` event on TabGroup when tab already selected

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-01-04T10:11:58.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
Labelsqe-5.4.0, tabgroup
ReporterFlavio De Stefano
AssigneeChee Kiat Ng
Created2015-11-30T10:53:46.000+0000
Updated2016-06-09T22:10:13.000+0000

Description

Sometimes you may need to capture the selected event on a TabGroup too when the tab is already selected. For example, in the Facebook iOS app, if you click on the Newsfeed button, and the Newsfeed tab is already selected, the ScrollView scrolls to top. https://github.com/appcelerator/titanium_mobile/pull/7512

Comments

  1. Hans Knöchel 2016-01-04

    PR merged, thank you [~kopiro]! We go back to the "focus" Event in 5.2.0, but the behavior is the same. This test case is for the QE to test the issue. Click on the "Tab 2" and watch the output. Click on the current tab again and watch the output. Before: One log shown Now: Two logs shown, because the "focus" event also fires, when the tab is already selected.
       var tabGroup = Titanium.UI.createTabGroup();
       
       var win1 = Titanium.UI.createWindow();
       var tab1 = Titanium.UI.createTab({window:win1, title: "Tab 1"});
       
       var win2 = Titanium.UI.createWindow();
       var tab2 = Titanium.UI.createTab({window:win2, title: "Tab 2"});
       
       tabGroup.addTab(tab1);
       tabGroup.addTab(tab2);
       
       tabGroup.addEventListener("focus", function(e) {
       	Ti.API.warn("Tab with index " + e.index + " was focused!");
       });
       
       tabGroup.open();
       
       
  2. Harry Bryant 2016-06-09

    Verified as fixed, subsequent clicks on a tab group will return focus events to the console. Tested On: iPhone 6S (9.3.2) Device Mac OSX El Capitan 10.11.5 Ti SDK: 5.4.0.v20160608165242 Appc Studio: 4.6.0.201605180604 Appc NPM: 4.2.7.-2 App CLI: 5.4.0-11 Xcode 7.3 Node v4.2.6 *Closing ticket.*

JSON Source