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

feat(android): snapping for ListView/TableView #13180

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Nov 15, 2021

work in progress / PoC

Snapping for ListView/TableView. Needs some more properties and documentation. But it is possible to add snapping to a ListView/TableView.

20211115_210628_edit.mp4

JIRA: https://jira.appcelerator.org/browse/[TICKET]

var btn = Ti.UI.createButton({title:"snap",bottom:0});
var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var snapping = true;
var listView = Ti.UI.createListView({
	snapping: snapping,
	templates: {
		test: {
			childTemplates: [{
				type: 'Ti.UI.View',
				childTemplates: [{
					type: 'Ti.UI.Label',
					bindId: 'label',
					properties: {
						color: 'black',
						bindId: 'label'
					}
				}],
				properties: {
					width: Ti.UI.FILL,
					height: 200,
					cardUseCompatPadding: true,
					backgroundColor: 'white',
				}
			}]
		}
	},
	defaultItemTemplate: 'test'
});
var section = Ti.UI.createListSection();
var items = [];

for (let i = 0; i < 100; i++) {
	items.push({
		label: {
			text: "item " + i
		},
		template: 'test'
	})
}



section.setItems(items);
listView.sections = [section];
btn.addEventListener('click', (e) => {
	snapping = !snapping;
	listView.snapping = snapping;
});
win.add(listView);
win.add(btn);
win.open();

@build
Copy link
Contributor

build commented Nov 15, 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.

Warnings
⚠️ Tests have failed, see below for more information.
⚠️ There is no linked JIRA ticket in the PR body. Please include the URL of the relevant JIRA ticket. If you need to, you may file a ticket on JIRA
Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 3 tests have failed There are 3 tests failing and 1157 skipped out of 20838 total tests.
📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍
📖

💾 Here's the generated SDK zipfile.

Tests:

ClassnameNameTimeError
android.emulator.5.0.Titanium.UI.View"after all" hook for "rgba fallback" (5.0.2)20.41
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.5.0.Titanium.UI.View"after each" hook for "getOrCreateView() should always return a View" (5.0.2)10.367
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.main.Titanium.Geolocation.methods#forwardGeocoder() works via callback argument (12)5.013
Error: expected false to be true
at Assertion.fail (/node_modules/should/cjs/should.js:275:13)
      at Assertion.value (/node_modules/should/cjs/should.js:356:9)
      at Geolocation.<anonymous> (/ti.geolocation.test.js:585:32)

Generated by 🚫 dangerJS against 436c247

@hansemannn
Copy link
Collaborator

iOS can do this as well: https://stackoverflow.com/questions/16088615/want-uitableview-to-snap-to-cell

@caspahouzer
Copy link
Contributor

caspahouzer commented Mar 26, 2022

@hansemannn hansemannn modified the milestones: 11.0.0, 11.1.0 May 27, 2022
@hansemannn hansemannn modified the milestones: 11.1.0, 12.0.0 Oct 7, 2022
@m1ga
Copy link
Contributor Author

m1ga commented Jul 18, 2023

@hansemannn any help with parity here? Would also be a nice feature

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.

5 participants