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

TableView: contentOffset improvements #14075

Open
1 task done
m1ga opened this issue Jul 5, 2024 · 0 comments
Open
1 task done

TableView: contentOffset improvements #14075

m1ga opened this issue Jul 5, 2024 · 0 comments
Labels
android bug ios needs triage This issue hasn't been reviewed by maintainers

Comments

@m1ga
Copy link
Contributor

m1ga commented Jul 5, 2024

I have searched and made sure there are no existing issues for the issue I am filing

  • I have searched the existing issues

Description

The TableView contentOffset value is different on Android/iOS:

Android:
There are getters table.contentOffset.x and table.contentOffset.y but the value is returning a native height value (you have to divide it by ldi). The value in the scroll event is already in local space

iOS:
The getter is 0 and it only has the scroll event values.

Expected Behavior

Getter should be available on both platforms and it should return the same value as the scroll event contentOffset.

Actual behavior

Reproducible sample

var ldi = Ti.Platform.displayCaps.logicalDensityFactor;

var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({
	title: "click"
})
var tableData = [];
for (var i = 0; i < 100; ++i) {
	tableData.push({
		title: "Test" + i
	})
}

var table = Ti.UI.createTableView({
	data: tableData
});
win.add(table);
win.add(btn);
btn.addEventListener("click", function() {
	console.log("Current: " + table.contentOffset.x + " - " +table.contentOffset.y, "Fixed: " + Math.round(table.contentOffset.y/ldi));
})
table.addEventListener("scroll", function(e) {
	console.log(e.contentOffset.x, e.contentOffset.y);
})
win.open();

Steps to reproduce

Run the app, scroll the table and click the button. The normal contentOffset.y value should be the same in both cases.

Platform

Android & iOS

SDK version you are using

12.4.0

Alloy version you are using

No response

@m1ga m1ga added bug needs triage This issue hasn't been reviewed by maintainers ios android labels Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug ios needs triage This issue hasn't been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

1 participant