[TIMOB-25660] Android: ListView 'canScroll' property cannot be set dynamically
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-01-24T00:36:50.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | Release 7.0.2 |
Components | Android |
Labels | ListView, android |
Reporter | Jason Kotchoff |
Assignee | Joshua Quick |
Created | 2018-01-10T23:04:26.000+0000 |
Updated | 2018-01-24T20:45:00.000+0000 |
Description
The 'canScroll' property on ListView for Android cannot be dynamically set. It has been implemented as a creation-only property. Please introduce a dynamic capability to run {color:red}listView.setCanScroll(false){color}; in android. This works correctly in iOS already.
Test case:
var win = Ti.UI.createWindow({backgroundColor: 'black'});
var canScroll = true;
var listView = Ti.UI.createListView({
top: 200
});
Ti.API.info("status", " canScroll " + listView.getCanScroll());
var sections = [];
var button = Ti.UI.createButton({title: "toggle", top: 3});
win.add(button);
button.addEventListener('click', function(){
Ti.API.info("status", " canScroll " + listView.getCanScroll());
canScroll = !canScroll;
listView.setCanScroll(canScroll);
Ti.API.info("status", " canScroll " + listView.getCanScroll());
});
var fruitSection = Ti.UI.createListSection({headerTitle: 'Fruits', canScroll: false});
var fruitDataSet = [
{properties: {title: 'Apple'}},
{properties: {title: 'Banana'}}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
var vegSection = Ti.UI.createListSection({headerTitle: 'Vegetables'});
var vegDataSet = [
{properties: {title: 'Carrots'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}},
{properties: {title: 'Potatoes'}}
];
vegSection.setItems(vegDataSet);
sections.push(vegSection);
listView.sections = sections;
win.add(listView);
win.open();
var fishSection = Ti.UI.createListSection({headerTitle: 'Fish'});
var fishDataSet = [
{properties: {title: 'Cod'}},
{properties: {title: 'Haddock'}}
];
fishSection.setItems(fishDataSet);
listView.appendSection(fishSection);
Hello, I was able to reproduce the issue in Android with SDK 7.0.1.GA. Listview "canScroll" does not work in Android, Working fine in iOS.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/9726 PR (7.0.X): https://github.com/appcelerator/titanium_mobile/pull/9727
FR Passed for both master & backport PR. Waiting for merge to become enabled.
Backport PR merged.
Master PR merged.
Verified the fix with SDK 7.0.2.v20180124113923 & 7.1.0.v20180124063413. Closing. Studio Ver: 5.0.0.201712081732 SDK Ver: 7.0.2.v20180124113923, 7.1.0.v20180124063413 OS Ver: 10.13.2 Xcode Ver: Xcode 9.2 Appc NPM: 4.2.11 Appc CLI: 7.0.1 Daemon Ver: 1.0.1 Ti CLI Ver: 5.0.14 Alloy Ver: 1.10.10 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1