Skip to content

Commit 8ec794c

Browse files
appdenchristophpurrer
authored andcommitted
Fix rendering template images with tintColor
This fixes a regression introduced by the previous commit, where images would no longer render with the `tintColor` on release builds. We must call `setTemplate:` (using `.template` property is illegal in Objective-C++ since `template` is reserved in C++) on the newly resized image instead of the original image. Confirmed icons look correct in the release build of Messenger Desktop.
1 parent ff5ffb0 commit 8ec794c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Libraries/Image/RCTImageView.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,10 +201,6 @@ - (void)updateWithImage:(UIImage *)image
201201
if (_renderingMode != image.renderingMode) {
202202
image = [image imageWithRenderingMode:_renderingMode];
203203
}
204-
#else // [TODO(macOS GH#774)
205-
if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) {
206-
[image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)];
207-
}
208204
#endif // ]TODO(macOS GH#774)
209205

210206
if (_resizeMode == RCTResizeModeRepeat) {
@@ -228,6 +224,12 @@ - (void)updateWithImage:(UIImage *)image
228224
#endif // ]TODO(macOS GH#774)
229225
}
230226

227+
#if TARGET_OS_OSX // [TODO(macOS ISS#2323203)
228+
if ((_renderingMode == UIImageRenderingModeAlwaysTemplate) != [image isTemplate]) {
229+
[image setTemplate:(_renderingMode == UIImageRenderingModeAlwaysTemplate)];
230+
}
231+
#endif // ]TODO(macOS ISS#2323203)
232+
231233
// Apply trilinear filtering to smooth out mis-sized images
232234
_imageView.layer.minificationFilter = kCAFilterTrilinear;
233235
_imageView.layer.magnificationFilter = kCAFilterTrilinear;

0 commit comments

Comments
 (0)