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): amend ListView marker behaviour #12350

Merged
merged 3 commits into from Jan 7, 2021

Conversation

garymathews
Copy link
Contributor

  • Allow markers to be added prior to item or section existing
  • Prevent errors from occurring when invalid markers are added
  • Validate list item is visible before firing marker event
TEST CASE
const win = Ti.UI.createWindow({ backgroundColor: 'gray' });

const items = [];
for (let i = 0; i < 100; i++) {
	items.push({ properties: { title: `Item #${i}` }});
}

const listView = Ti.UI.createListView({
	sections: [ Ti.UI.createListSection({ items }) ]
});

// Add valid marker.
listView.addMarker({
	sectionIndex: 0,
	itemIndex: 32
});

// Add invalid marker.
listView.addMarker({
	sectionIndex: 1,
	itemIndex: 1
});

// Add invalid marker.
listView.addMarker({
	sectionIndex: 0,
	itemIndex: -1
});

// Add invalid marker.
listView.addMarker({
	sectionIndex: -1,
	itemIndex: 1
});

// Add invalid marker.
listView.addMarker({
	sectionIndex: 0,
	itemIndex: 101
});

listView.addEventListener('marker', e => {
	alert(JSON.stringify({
		sectionIndex: e.sectionIndex,
		itemIndex: e.itemIndex
	}, null, 1));
});

win.add(listView);
win.open();

JIRA Ticket

@build
Copy link
Contributor

build commented Dec 17, 2020

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

💾 Here's the generated SDK zipfile.

📖 ✊ 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 14870 total tests.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.UI.View"after all" hook (5.0.2)10.011
Error: timeout of 10000ms exceeded
at Titanium.<anonymous> (/ti-mocha.js:6535:53723)

Generated by 🚫 dangerJS against d12a720

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@ssekhri
Copy link

ssekhri commented Dec 22, 2020

@garymathews with the changes in the PR the marker event on the listview is not fired if initially the marker is added for a section that does not exist but that section is added later and even then upon scrolling to the section,row with the marker the event is not fired. It used to work with 9.2.2.GA.
Check the sample code on the comment in the jira ticket https://jira.appcelerator.org/browse/TIMOB-28293?focusedCommentId=457925&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-457925

@ssekhri
Copy link

ssekhri commented Jan 5, 2021

FR Passed.
Verified on:
Mac OS: 10.15.4
SDK: 10.0.0.v20210105134342
Appc CLI: 8.1.1
JDK: 11.0.6
Node: 12.16.1
Studio: 6.0.0.202005141803
Pixel 3 XL(v11.0) emulator

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

5 participants