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): expose contentOffset getter in TableView/ListView #14058

Merged
merged 1 commit into from
Jun 15, 2024

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jun 9, 2024

Method was already but not exposed as a getter.

const win = Ti.UI.createWindow();

var tableData = [];
for (var i = 0; i < 100; ++i) {
	tableData.push({
		title: "id" + i
	})
}

const tbl = Ti.UI.createTableView({
	data: tableData
});
win.add(tbl)
win.open();

win.addEventListener("open", function() {
	console.log(tbl.contentOffset);

	tbl.setContentOffset({
		x: 0,
		y: 200
	}, {
		animated: false
	})

	setTimeout(function() {
		console.log(tbl.contentOffset);
	}, 500)
})

ListView

var win = Ti.UI.createWindow({backgroundColor: 'gray'});
var listView = Ti.UI.createListView();
var sections = [];

var fruitDataSet = []
for (var i=0;i<100;++i){
	fruitDataSet.push({properties: { title: 'Apple'}})
}
var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits', items: fruitDataSet});
sections.push(fruitSection);

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

win.addEventListener("open", function() {
	console.log(listView.contentOffset);

	listView.setContentOffset({
		x: 0,
		y: 200
	}, {
		animated: false
	})

	setTimeout(function() {
		console.log(listView.contentOffset);
	}, 500)
})

@hansemannn hansemannn merged commit 1f75084 into master Jun 15, 2024
7 checks passed
@m1ga m1ga deleted the tableContentOffset branch June 15, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants