[TIMOB-27721] Android: Ti.UI.ImageView#tintColor is multiplied, not replaced (like iOS)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-05-04T12:49:03.000+0000 |
Affected Version/s | Release 9.0.0, Release 8.3.1 |
Fix Version/s | Release 9.0.2 |
Components | Android |
Labels | ImageView, android, breaking-change, image, mask, parity, tintColor |
Reporter | Hans Knöchel |
Assignee | Gary Mathews |
Created | 2020-01-19T19:12:01.000+0000 |
Updated | 2020-05-07T15:37:05.000+0000 |
Description
This is an issue that took us a while to track down. And thanks to @miga for the additional check!
The issue is that the
tintColor
property of the Ti.UI.ImageView
multiply the provided color, instead of actually replacing the color. This results in an unexpected behavior, since the provided color is not what you actually see. This works well on iOS (which is where the tintColor
API was introduced first and should be followed here. For other masks, the Ti.UI.MaskedImage
can be used, but we need strong parity here!
Example:
const window = Ti.UI.createWindow();
const icon = Ti.UI.createImageView({
tintColor: 'red',
width: 30,
image: 'example.png'
});
window.add(icon);
window.open();
*Work-Around:*
Use a Ti.UI.MaskedImage
instead.
const window = Ti.UI.createWindow();
const icon = Ti.UI.createMaskedImage({
mask: 'example.png',
tint: 'red',
width: 30,
});
window.add(icon);
window.open();
Attachments
File | Date | Size |
---|---|---|
example.png | 2020-01-19T19:11:46.000+0000 | 2355 |
PR: https://github.com/appcelerator/titanium_mobile/pull/11441
FR Passed for Master, awaiting backport for 9_0_X.
merged to master for 9.1.0 target, cherry-picked commit (c2633b0a98cf9d4c9c2005e4ed7aeb034a3da794) to 9_0_X for 9.0.2 target
*Closing ticket.* Fix verified in SDK version 9.1.0.v20200501090150 and 9.0.2.v20200430111828 Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11441