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

iOS: "this" value in event listener is set to child component when child component is clicked

    Details

      Description

      Problem

      "this" value in event listener is set to child component when child component is clicked.

      Steps to reproduce

      var win = Ti.UI.createWindow({
          backgroundColor: '#000',
          navBarHidden: true
      });
       
      var view = Ti.UI.createView({ width: '100%', height: '100%', backgroundColor: '#f00' });
       
      view.addEventListener('click', function(e){
          Ti.API.info('View click');
          Ti.API.info(this);
      });
      var button = Ti.UI.createButton({width:150, height:150, title: 'Click me!' });
       
      view.add(button);
      win.add(view);
       
      win.open();
      

      Result: Click on the button and see the output. "this" value produces "[object TiUIButton]".

      Expected result: "this" inside event listener should point to UI object to which that listener is attached (the output should produce "[object TiUIView]").

      This works as expected on Android.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ngupta Neeraj Gupta
                Reporter:
                fcasali Federico Casali
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-13313
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration