Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27239] TextField padding property uses different units between Android and iOS

GitHub Issuen/a
TypeBug
Priorityn/a
StatusReopened
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterACI Informatica
AssigneeEric Merriman
Created2019-06-04T09:22:16.000+0000
Updated2019-07-12T18:43:32.000+0000

Description

*Problem* Adding the same padding to a TextField on Android and iOS leads to different results. It seems that Android uses pixels beacuse on phones with different densities you have different sizes of padding using the same digit. Instead iOS uses dp (correctly beacuse default unit in tiapp.xml is dp). *Test case*

Execute below code

Padding (focus only on left and right beacuse top and bottom aren't working on iOS) is different between Android (smaller) and iOS (bigger).

$.win.open();
<Alloy>
	<Window id="win">
			<TextField id="field"/>
	</Window>
</Alloy>
"#win": {
	backgroundColor: 'black'
}

"#field": {
	height: Ti.UI.SIZE,
	width: Ti.UI.SIZE,
	top: 32,
	backgroundColor: 'red',
	padding: {
		top: 32,
		bottom: 32,
		right: 32,
		left: 32,
	},
	value: 'Test Test Test Test'
}

Attachments

FileDateSize
android.jpg2019-06-04T08:55:45.000+000088793
ios.png2019-06-04T08:55:44.000+000019262

Comments

  1. Giorgio Tassistro 2019-06-04

    I think that height and width contrast with padding. Try to use a view as a container for textField and try to remove height and width elements. Regards
  2. Sharif AbuDarda 2019-06-04

  3. ACI Informatica 2019-06-05

    [~sdarda] This isn't a duplicate, but a different bug on the same property. The other one is for top and bottom padding not working on iOS; this one is for different measurement units used between Android and iOS (of course can be noticed only on left and right padding as stated in point 2 of the test case). Used the same example code because is very basic and the property is the same.
  4. Sharif AbuDarda 2019-07-12

    Hello, This is a valid issue with SDK 8.0.2.GA in iOS simulator and Android emulator. Thanks.

JSON Source