Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24434] iOS: Unable to modify key of an Object property

GitHub Issuen/a
TypeBug
PriorityMedium
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 6.0.0, Release 6.0.1
Fix Version/sn/a
ComponentsiOS
Labelsn/a
ReporterYellowcube
AssigneeVijay Singh
Created2017-02-27T15:25:51.000+0000
Updated2018-10-03T11:06:44.000+0000

Description

- Properties which are writable Objects such as Point and Font cannot have their keys directly changed. *TEST CASE #1*
var win = Ti.UI.createWindow({
        title: 'TIMOB-24406',
        backgroundColor: 'gray'
    }),
    lbl = Ti.UI.createLabel({
        text: 'click me',
        font: {
            fontSize: 24
        }
    });

win.addEventListener('click', function(e) {
    // direct access to fontSize
    lbl.font.fontSize = lbl.font.fontSize + 4;
});

win.add(lbl);
win.open();
*TEST CASE #2*
var win = Ti.UI.createWindow({
        title: 'TIMOB-24406',
        backgroundColor: 'gray'
    }),
    iv = Ti.UI.createView({
        backgroundColor: 'red',
        width: '320',
        height: '480',
        center: {
            x: 1,
            y: 1
        }
    });

win.addEventListener('click', function(e) {
    iv.center.x = e.x;
    iv.center.y = e.y;
    //iv.center = {x: e.x, y: e.y}; // workaround
    Ti.API.info('center.x: ' + iv.center.x);
    Ti.API.info('center.y: ' + iv.center.y);
});

win.add(iv);
win.open();

Comments

  1. Hans Knöchel 2017-03-01

    Can we determine the affected properties before? I can think of font and center, what else?
  2. Hans Knöchel 2018-04-01

    I've checked this and it's an issue with the JSClassDefinition implementation in JavaScriptCore which does not handle object changes as part of the setProperty callback. I don't see much that we can do since thats the earliest point where we are able to receive back from JSCore.

JSON Source