Skip to content

Commit

Permalink
Do not override decoders to RCTImageLoader (#29711)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sjchmiela authored and facebook-github-bot committed Sep 24, 2020
1 parent 371430d commit 663b5a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ - (void)setImageCache:(id<RCTImageCache>)cache
_decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)];
}

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

0 comments on commit 663b5a8

Please sign in to comment.