[TIMOB-25615] ListItem height property doesn't work at all & no where it has been mentioned how to set a fixed height
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | engReviewed |
Reporter | Prashant Saini |
Assignee | Unknown |
Created | 2017-12-15T15:04:38.000+0000 |
Updated | 2019-07-30T17:31:34.000+0000 |
Description
*ListItem's height* property doesn't set the *height* of ListItem as it's mentioned in the docs at here: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ListItem-property-height
Moreover, *height* property is listed as a direct property for *ListItem* since *Ti SDK 3.1.0* instead as an accessor or inherited property, so it is simply supposed to work irrespective of any *Ti SDK*.
Also, it is not mentioned anywhere that how users can set a *fixed height* to a *list-item*, so it's clueless for anyone who wants to set a fixed height.
I have tried this stuff on *Ti SDK 7.0.0.GA* for both iOS & Android & it doesn't just work on any platform. I couldn't try it on older SDK as I only have 7.0.0.GA.
Here's the very sample code picked from doc itself:
<Alloy>
<Window title="List View">
<ListView id="list">
<ListSection id="accounts">
<ListItem title="Checking" height='50' />
<ListItem title="Savings" />
</ListSection>
</ListView>
</Window>
</Alloy>
I have also attached a sample of how it look like on iOS 11.
One of the user in Ti-Slack told me that it only works if we use a class property on ItemTemplate & set height, backgroundColor on class. Here's what he meant:
<!-- even this doesn't work-->
<ItemTemplate height="70" name='template'>
<!-- but this works unexpectedly - add a class & set desired properties like height in this class -->
<ItemTemplate class="saini" name='template'>
".saini" : { height : 70, backgroundColor:'red' }
Then only it works but again here's a glitch that if you try to set any property directly in XML, it doesn't work. It works only through a class defined in *.tss* file & it also creates below log warnings:
[WARN] : Could not retrieve template for SIZE measurement
[WARN] : Could not retrieve template for SIZE measurement
[WARN] : Could not retrieve template for SIZE measurement
[WARN] : Could not retrieve template for SIZE measurement
So, it's pretty clear that things are not working at all as they should be. Either way, there's an issue.
Thanks
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2017-12-16 at 12.49.12 AM.png | 2017-12-15T21:48:28.000+0000 | 64416 |
Simulator Screen Shot - iPhone 5s - 2017-12-15 at 20.32.35.png | 2017-12-15T15:03:32.000+0000 | 33253 |
Simulator Screen Shot - iPhone 5s - 2017-12-15 at 21.03.21.png | 2017-12-15T15:33:38.000+0000 | 33521 |
Hello, I couldn't reproduce the issue in my test. The listitem height does work for me. See screenshot. Can you try to set height without the ' ' ? For me, it works for both as string and value. Thanks.
I saw that your iOS simulator is version 11.2, but mine was 11.0 with Xcode 9. Can you try on same version & also it is not working on Android. So it's still a bug if it's not working on all iOS versions & Android version.
Hello [~prashant_saini]< I was able to reproduce the issue for Android. The listitem height does not work in Android. But works on iOS. Moving to TIMOB. Thanks.
Hi Sharif AbuDarda, I am sure it also doesn't work for iOS even on my machine, therefore I am mentioning the info retrieved by
appc info
command to make sure you can test & confirm on same environment: *Operating System* Name = Mac OS X Version = 10.12.6 *Node.js* Node.js Version = 8.9.3 npm Version = 5.5.1 *Appcelerator CLI* Installer = 4.2.11 Core Package = 7.0.0 *Titanium CLI* CLI Version = 5.0.14 node-appc Version = 0.2.41 *Titanium SDKs* 7.0.0.GA Version = 7.0.0 Install Location = /Users/prashant/Library/Application Support/Titanium/mobilesdk/osx/7.0.0.GA Platforms = iphone, android node-appc Version = 0.2.43 *Xcode* 9.0 (build 9A235) - Xcode default Install Location = /Applications/Xcode.app/Contents/Developer iOS SDKs = 11.0 iOS Simulators = 11.0 Watch SDKs = none Watch Simulators = none Supported by TiSDK 7.0.0.GA = yes EULA Accepted = yesWe are seeing this same issue in iOS...getting a ton of these on our list views: [WARN] Could not retrieve template for SIZE measurement
[~amukherjee] I can reproduce the issue under SDK 8.0.2.GA. Still investigating.
Right. Despite what our docs state, you cannot set the
ListViewItem
object's "height". You cannot set it during creation. Nor can you change it dynamically with a call toupdateItemAt()
. This is true on both Android and iOS. The ListView item's "height" must be specified by the template. So, if you want different ListView items to have different heights, then your only option available "today" is to create multiple templates with different heights. A ListView item has a "template" property which you can set dynamically. Have a look at the "List Items with an Item Template" example in the link below. It shows how to use 2 templates ("plainTemplate" and "redTemplate"). You can apply similar logic to have different heights instead. https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.ListItem