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

Android: Getter and Setter not getting added for any new property on NativeObject

    Details

    • Type: Bug
    • Status: Open
    • Priority: Low
    • Resolution: Unresolved
    • Affects Version/s: Release 3.1.2
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Description

      Getter and Setter not getting added for any new property on NativeObject automatically where as it works fine on ios.

      var win=Ti.UI.createWindow();
      var myApp = {};
        
      myApp.ui = {};
        
      myApp.ui.createMyView = function() {
          var v = Ti.UI.createView({});
          v.foo = 100;
         
          v.getSomething = function() {
              return v.foo;
          };
       
          v.setSomething = function(val) {
              v.foo = val;
          }
            
          v.getFood = 200;
        
          return v;
      };
        
      var myView = myApp.ui.createMyView();
       
      Ti.API.info(myView.getSomething);
      Ti.API.info(myView.setSomething);
      Ti.API.info(myView.getFood);
      Ti.API.info(myView.getFoo);
       
      Ti.API.info(myView.getSomething());
      myView.setSomething(50);
      Ti.API.info(myView.getSomething());
       
      Ti.API.info(myView.getFoo());
      myView.setFoo(10);
      Ti.API.info(myView.getFoo());
      win.open();
      

      Expected Result:
      This is for ios:
      [INFO] <KrollCallback: [some address here]>
      [INFO] <KrollCallback: [some address here]>
      [INFO] 200
      [INFO] [object TiUIView]
      [INFO] 100
      [INFO] 50
      [INFO] 50
      [INFO] 10

      Actual Result:
      On ios:
      [INFO] <KrollCallback: [some address here]>
      [INFO] <KrollCallback: [some address here]>
      [INFO] 200
      [INFO] [object TiUIView]
      [INFO] 100
      [INFO] 50
      [INFO] 50
      [INFO] 10

      On android: Getting exception

      E/TiExceptionHandler(19656): (main) [1,11350] - In acceptance.js:668,22
      E/TiExceptionHandler(19656): (main) [0,11350] - Message: Uncaught TypeError: Object #<View> has no method 'getFoo'
      E/TiExceptionHandler(19656): (main) [1,11351] - Source: Ti.API.info(myView.getFoo());

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              pagarwal Priya Agarwal
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

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

                  Git Source Code