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): make scrollToTop and scrollToBottom animatable #14180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Feb 6, 2025

Parity for #13204

Test code

var toggle = false;
var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({
	title: "smooth scroll",
	bottom: 20,
	left: 10
});
var btn2 = Ti.UI.createButton({
	title: "normal scroll",
	bottom: 20,
	right: 10
});
var sv = Ti.UI.createScrollView({
	height: Ti.UI.FILL,
	layout:"vertical",
	contentHeight: Ti.UI.SIZE,
	scrollType: "vertical"
})
win.add([sv, btn, btn2]);
for (var i = 0; i < 50; ++i) {
	var lbl = Ti.UI.createLabel({
		text: "Label " + i,
		height: 80
	});
	sv.add(lbl);
}
btn.addEventListener("click", function() {
	if (toggle) {
		sv.scrollToTop({
			animated: true
		})
	} else {
		sv.scrollToBottom({
			animated: true
		})
	}
	toggle = !toggle;
})
btn2.addEventListener("click", function() {
	if (toggle) {
		sv.scrollToTop()
	} else {
		sv.scrollToBottom()
	}
	toggle = !toggle;
})
win.open();

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.

1 participant