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): textTransform for Label #14178

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

feat(android): textTransform for Label #14178

wants to merge 1 commit into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Feb 6, 2025

Adds CSS like textTransform with uppercase, lowercase and none (default):

var toggle = false;
var win = Ti.UI.createWindow({layout: "vertical"});
var lbl1 = Ti.UI.createLabel({ text: "Just a Text wiTH ranDOm leTTerS (random)"});
var lbl2 = Ti.UI.createLabel({ text: "Just a Text wiTH ranDOm leTTerS (uppercase)",
  textTransform: "uppercase"
});
var lbl3 = Ti.UI.createLabel({ text: "Just a Text wiTH ranDOm leTTerS (lowercase)",
  textTransform: "lowercase"
});
var btn = Ti.UI.createButton({ title: "toggle"});

btn.addEventListener("click", function() {
  if (!toggle) {
		lbl1.textTransform = "lowercase";
		lbl2.textTransform = "none";
		lbl3.textTransform = "uppercase";
	} else {
		lbl1.textTransform = "none";
		lbl2.textTransform = "uppercase";
		lbl3.textTransform = "lowercase";
	}
	toggle = !toggle;
})
win.add([lbl1, lbl2, lbl3, btn]);
win.open();

Screenshot_20250206-113228

Note:
I've used a string here and not constants. That way you can use the normal CSS properties instead of long Ti constants. I can change it but it feels a bit more intuitive to use it like this.

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