Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27779

Android: Setting "labels" via TabbedBar "click" event hangs app

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 8.0.0
    • Fix Version/s: Release 9.1.0
    • Component/s: Android
    • Environment:

      Titanium SDK 8.3.0GA, Android Studio 3.5.3. Android 10.0 (Q) API level 29.

    • Story Points:
      5
    • Sprint:
      2020 Sprint 10, 2020 Sprint 11, 2020 Sprint 12, 2020 Sprint 13, 2020 Sprint 14, 2020 Sprint 15, 2020 Sprint 16

      Description

      Steps to reproduce:

      1. Build and run the below code on Android.
      2. Tap on one of the tabs.
      3. Notice that the app hangs.

      var window = Ti.UI.createWindow();
      var tabbedBar = Ti.UI.createTabbedBar();
      tabbedBar.labels = ["One", "Two", "Three"];
      tabbedBar.addEventListener("click", function() {
      	console.log(new Date() + " tbrSortTLby Click event triggerred");
      	tabbedBar.labels = ['Three', 'Four', 'Five'];
      });
      window.add(tabbedBar);
      window.open();
      

      Cause:
      Setting the "labels" property causes the "click" event to be fired. So, setting "labels" within a "click" event listener will cause infinite recursion to occur which will eventually cause a crash.

      Work-Around:
      Defer setting the "labels" property via setTimeout() within the "click" listener.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rislam Riduanul Islam
                Reporter:
                tlau Tony Lau
                Reviewer:
                Joshua Quick
                Tester:
                Samir Mohammed
              • Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration