Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8742] Android: Provide a means to "unset" positioning properties for a view

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-04-18T17:50:30.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.1.0, Sprint 2012-08
ComponentsTiAPI
Labelscore, layout
ReporterOpie Cyrus
AssigneeMax Stepanov
Created2012-04-16T13:04:22.000+0000
Updated2012-08-16T03:32:16.000+0000

Description

Provide a means to "unset" positioning properties for a view so that layout behavior goes back to the default behavior IE:
view.left = 10; 

/// stuff happens and now you want to revert to default positioning for the element
view.left = ?;

Comments

  1. Ivan Skugor 2012-04-18

    I would prefer "view.left = undefined" or "view.left = null". The reason for that lies in the fact that people will try to do same thing on other (Titianium JS host) objects that might blow things up.
  2. Max Stepanov 2012-04-18

    These will work too after the fix will be pushed:
       view.left = undefined;
       view.left = null;
       
  3. Ivan Skugor 2012-04-18

    Cool, thanks. :)
  4. Max Stepanov 2012-04-18

    Test code (already works on iOS and MobileWeb)
       var win=Ti.UI.createWindow({
       backgroundColor : 'blue'
       });
        
       var view=Ti.UI.createView({
       width: 500,
       height: 300,
       top: 10,
       bottom: 10,
       left: 0,
       backgroundColor: 'red'
       });
        
        
       win.add(view);
       win.open();
       
       setTimeout(function() {view.top=undefined;}, 2000);
       
  5. Max Stepanov 2012-04-18

    PR pending https://github.com/appcelerator/titanium_mobile/pull/2030
  6. Shyam Bhadauria 2012-08-16

    Environment used for verification - Tested with Titanium SDK: 2.2.0.v20120815194913 Tested with Titanium  Studio: 2.1.1.201207271312 Device - Samsung GALAXY Note Android 2.3.6 Machine OS - MAC 10.7.3

JSON Source