[TIMOB-14881] Android: Getter and Setter not getting added for any new property on NativeObject
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Low |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | Release 3.1.2 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | qe-3.1.2 |
| Reporter | Priya Agarwal |
| Assignee | Unknown |
| Created | 2013-08-14T11:52:03.000+0000 |
| Updated | 2018-02-28T20:03:58.000+0000 |
Description
Getter and Setter not getting added for any new property on NativeObject automatically where as it works fine on ios.
[INFO]
[INFO] 200
[INFO] [object TiUIView]
[INFO] 100
[INFO] 50
[INFO] 50
[INFO] 10
Actual Result:
On ios:
[INFO]
[INFO]
[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 # has no method 'getFoo'
E/TiExceptionHandler(19656): (main) [1,11351] - Source: Ti.API.info(myView.getFoo());
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]
Reproducible on Android device and simulator. Titanium SDK 3.1.3.v20130829174830 Appcelerator Studio 3.1.3.201308252005 CLI 3.1.2.GA Node 0.10.13 Also, fixed a small typo in the sample code: line 30:
changed to: