Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): scrolling a ListView with headerView #12423

Closed
wants to merge 1 commit into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jan 29, 2021

JIRA: https://jira.appcelerator.org/browse/AC-6670

Provide a clear PR title prefixed with [TICKET]

Optional Description:

If the first element of a ListView is not a section but a headerView it will crash with the current SDK 9.3.1 while scrolling.

Example:

var win = Ti.UI.createWindow({ backgroundColor: 'white' });
var headerView = Ti.UI.createView({ height: Ti.UI.SIZE, width: Ti.UI.FILL, backgroundColor:"#444"});
var headerLabel = Ti.UI.createLabel({ height:Ti.UI.SIZE, width: Ti.UI.FILL, left: '15dp', right: '15dp', top: '15dp', color: 'black', text: 'Demo text'});
headerView.add(headerLabel);
var listView = Ti.UI.createListView({height: Ti.UI.FILL,top: 0,headerView: headerView});
var sections = [];
var fruitDataSet = [
    { properties: { title: 'Apple', color: 'black' } },
    { properties: { title: 'Banana', color: 'black' } },
];
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits', items: fruitDataSet });
sections.push(fruitSection);
var vegDataSet = [
    { properties: { title: 'Carrots', color: 'black' } },
    { properties: { title: 'Potatoes', color: 'black' } },
];
var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables', items: vegDataSet });
sections.push(vegSection);
var fishDataSet = [
    { properties: { title: 'Cod', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
    { properties: { title: 'Haddock', color: 'black' } },
];
var fishSection = Ti.UI.createListSection({ headerTitle: 'Fish', items: fishDataSet });
sections.push(fishSection);
listView.sections = sections;
listView.addEventListener("scrollend",function(e){console.log(e.firstVisibleItemIndex)});
win.add(listView);
win.open();

@build build added this to the 10.0.0 milestone Jan 29, 2021
@build build requested a review from a team January 29, 2021 18:20
@build
Copy link
Contributor

build commented Jan 29, 2021

Fails
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

🚫 Tests have failed, see below for more information.
Messages
📖

💾 Here's the generated SDK zipfile.

📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 1 tests have failed There are 1 tests failing and 899 skipped out of 14875 total tests.

Tests:

ClassnameNameTimeError
ios.macos.Titanium.Blobimage dimensions should be reported in pixels (10.15.5)0.005
Error: expected 6 to be 11
value@file:///node_modules/should/cjs/should.js:356:23
postlayout@file:///ti.blob.test.js:483:33

Generated by 🚫 dangerJS against 1396065

@garymathews
Copy link
Contributor

Superseded by #12424

@garymathews garymathews closed this Feb 1, 2021
@m1ga m1ga deleted the fixListViewHeader branch March 3, 2021 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants