Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27721] Android: Ti.UI.ImageView#tintColor is multiplied, not replaced (like iOS)

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2020-05-04T12:49:03.000+0000
Affected Version/sRelease 9.0.0, Release 8.3.1
Fix Version/sRelease 9.0.2
ComponentsAndroid
LabelsImageView, android, breaking-change, image, mask, parity, tintColor
ReporterHans Knöchel
AssigneeGary Mathews
Created2020-01-19T19:12:01.000+0000
Updated2020-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

FileDateSize
example.png2020-01-19T19:11:46.000+00002355

Comments

  1. Hans Knöchel 2020-01-19

    PR: https://github.com/appcelerator/titanium_mobile/pull/11441
  2. Samir Mohammed 2020-04-28

    FR Passed for Master, awaiting backport for 9_0_X.
  3. Christopher Williams 2020-04-28

    merged to master for 9.1.0 target, cherry-picked commit (c2633b0a98cf9d4c9c2005e4ed7aeb034a3da794) to 9_0_X for 9.0.2 target
  4. Samir Mohammed 2020-05-04

    *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

JSON Source