Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26453] Android: default value of borderWidth of view is not respected, if borderRadius is set (but no borderColor)

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-11-29T19:10:42.000+0000
Affected Version/sRelease 7.0.0
Fix Version/sRelease 8.0.0
ComponentsAndroid
Labelsandroid, defect, parity, regression
ReporterMa Wenli
AssigneeYordan Banev
Created2018-10-11T07:48:40.000+0000
Updated2018-11-29T19:11:10.000+0000

Description

According to the doc (https://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI.View-property-borderWidth), default value of borderWidth of view should be 0 as long as borderColor is not set. However, looks like this default value is not respected on Android, if borderRadius of the view is defined. Sample code to reproduce (paste the following code to a new mobile app project and run it on Android):
var win = Titanium.UI.createWindow({
	height: Titanium.UI.FILL,
	width: Titanium.UI.FILL,
	layout: 'vertical',
	backgroundColor: '#FFFFFF'
});

var view1 = Titanium.UI.createView({
	top: 20,
	height: 100,
	width: 280,
	backgroundColor: '#000000'
	// No borderRadius
});
view1.add(Titanium.UI.createLabel({
	color: '#FF0000',
	text: 'Click here to test!'
}));
view1.addEventListener('click', function() {
	view1.setBackgroundColor('#00FFFF');
});

var view2 = Titanium.UI.createView({
	top: 20,
	height: 100,
	width: 280,
	backgroundColor: '#000000',
	borderRadius: 5
});
view2.add(Titanium.UI.createLabel({
	color: '#FF0000',
	text: 'Click here to test!'
}));
view2.addEventListener('click', function() {
	view2.setBackgroundColor('#00FFFF');
});

win.add(view1);
win.add(view2);

win.open();
After launching the sample app, click the two buttons (views) on the screen one by one and their background colour will change. Then it can be clearly observed that the actual border width of the second view is not 0 (the default value specified in doc), since we can see black border around it. By the way, on iOS the actual behaviour matches well with the doc. There is no black border around any view after the background colour gets changed.

Comments

  1. Yordan Banev 2018-10-26

    That's a regression in 7.0.0.GA when a default width for border was added. Introduced by me with this PR: https://github.com/appcelerator/titanium_mobile/pull/9510 PR: https://github.com/appcelerator/titanium_mobile/pull/10402
  2. Keerthi Mahalingam 2018-11-19

    FR passed. Waiting for CR to merge

JSON Source