Skip to content

Commit 663b5a8

Browse files
sjchmielafacebook-github-bot
authored andcommitted
Do not override decoders to RCTImageLoader (#29711)
Summary: I (actually, [we](expo/expo#9858)) noticed GIFs are no longer animating in Expo client after [enabling TurboModules](expo/expo#9687). ## Changelog [iOS] [Fixed] - Fix `RCTImageLoader` not using decoders provided. <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> Pull Request resolved: #29711 Test Plan: ![cat](https://user-images.githubusercontent.com/1151041/90775800-90112c00-e2f9-11ea-95cd-ab95a97068f4.gif) The cat is moving! Before applying this commit `RCTGIFDecoder` provided in the initalizer is removed from the `_decoders` array in the ```objc _decoders = [_bridge modulesConformingToProtocol:protocol(RCTImageDataDecoder)]; ``` Also, compare https://github.com/facebook/react-native/blob/8f306cd66a8bc6054ee13701f02329ab5817b69a/Libraries/Image/RCTImageLoader.mm#L243-L250 and https://github.com/facebook/react-native/blob/8f306cd66a8bc6054ee13701f02329ab5817b69a/Libraries/Image/RCTImageLoader.mm#L177-L184 This PR makes `_decoders` behave the same as `_loaders`. Reviewed By: PeteTheHeat Differential Revision: D23908238 Pulled By: fkgozali fbshipit-source-id: 1d7a6e0d180277f23d8c28916734713bc1833b8b
1 parent 371430d commit 663b5a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/Image/RCTImageLoader.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ - (void)setImageCache:(id<RCTImageCache>)cache
247247
_decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)];
248248
}
249249

250-
_decoders = [[_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)] sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageDataDecoder> a, id<RCTImageDataDecoder> b) {
250+
_decoders = [_decoders sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageDataDecoder> a, id<RCTImageDataDecoder> b) {
251251
float priorityA = [a respondsToSelector:@selector(decoderPriority)] ? [a decoderPriority] : 0;
252252
float priorityB = [b respondsToSelector:@selector(decoderPriority)] ? [b decoderPriority] : 0;
253253
if (priorityA > priorityB) {

0 commit comments

Comments
 (0)