Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20464] iOS: Picker does not accept percent as height/width

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2016-06-09T23:30:45.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsiOS
LabelsAL-5.4.0, picker, qe-5.2.0
ReporterJosh Longton
AssigneeAngel Petkov
Created2016-02-25T19:08:25.000+0000
Updated2016-06-14T16:56:09.000+0000

Description

Picker does not accept percent as height/width it needs pixels. http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.Picker-property-height *Steps to reproduce:* Add a picker to a view and set the height/width as a percentage or use the app.js below *Actual :* The picker does not use the percentage as the height/width. !Screen Shot 2016-02-25 at 9.21.27 AM.png|thumbnail! *Expected:* The Picker should either accept height/width as a percentage or scaling the picker should use pixels !Screen Shot 2016-02-25 at 9.19.35 AM.png|thumbnail! *App.js*
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
  exitOnClose: true,
  layout: 'vertical'
});

var picker = Ti.UI.createPicker({
  type:Ti.UI.PICKER_TYPE_DATE,
  minDate:new Date(2009,0,1),
  maxDate:new Date(2014,11,31),
  value:new Date(2014,3,12),
  top:50,
  height:"100%",
  width:"100%"
});

win.add(picker);
win.open();

picker.addEventListener('change',function(e){
  Ti.API.info("User selected date: " + e.value.toLocaleString());
});

Attachments

FileDateSize
Screen Shot 2016-02-25 at 9.19.35 AM.png2016-02-25T17:21:59.000+000063126
Screen Shot 2016-02-25 at 9.21.27 AM.png2016-02-25T17:21:59.000+000049618

Comments

  1. Angel Petkov 2016-02-27

    Use code provided to test. PR: https://github.com/appcelerator/titanium_mobile/pull/7781/files
       var win = Ti.UI.createWindow({
         exitOnClose: true,
         backgroundColor: 'white'
       });
        
        var picker = Ti.UI.createPicker({
         type:Ti.UI.PICKER_TYPE_DATE,
         minDate:new Date(2009,0,1),
         maxDate:new Date(2014,11,31),
         value:new Date(2014,3,12),
         top:50,
         height:'100%',
         width:'100%',
         backgroundColor:'Blue'
       });
       
       function postLayout() { 
       	console.log('postlayout');
       	Ti.API.info("Height", picker.getHeight());
       	Ti.API.info("Width", picker.getWidth());
       	picker.removeEventListener('postlayout',postLayout);
       }
        
       picker.addEventListener('postlayout',postLayout);
       
        
       win.add(picker);
       win.open();
       
  2. Harry Bryant 2016-06-14

    Closing ticket as "Won't Fix". After discussion with the developers assigned to this ticket, the original fix was causing more issues than it resolved, and was ultimately reverted.

JSON Source