Skip to content

Commit

Permalink
Use new provider api for images in RNTester (facebook#26990)
Browse files Browse the repository at this point in the history
Summary:
Local assets do not work in release mode since they rely on `RCTLocalAssetImageLoader`. Since converting image native modules to turbo modules the old loading method no longer works. This uses the new api in RNTester.

## Changelog

[Internal] [Fixed] - Use new provider api for images in RNTester
Pull Request resolved: facebook#26990

Test Plan: Tested that local images work in RNTester images example in release mode

Differential Revision: D18174117

Pulled By: cpojer

fbshipit-source-id: 71f1dc597742c6d41c57ad20a1221e85dc63ba2f
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Oct 28, 2019
1 parent 8cfa379 commit e1395ec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions RNTester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTJavaScriptLoader.h>
#import <React/RCTLinkingManager.h>
#import <React/RCTImageLoader.h>
#import <React/RCTLocalAssetImageLoader.h>
#import <React/RCTGIFImageDecoder.h>
#import <React/RCTRootView.h>

#import <cxxreact/JSExecutor.h>
Expand Down Expand Up @@ -142,6 +145,13 @@ - (Class)getModuleClassFromName:(const char *)name

- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
{
if (moduleClass == RCTImageLoader.class) {
return [[moduleClass alloc] initWithRedirectDelegate:nil loadersProvider:^NSArray<id<RCTImageURLLoader>> *{
return @[[RCTLocalAssetImageLoader new]];
} decodersProvider:^NSArray<id<RCTImageDataDecoder>> *{
return @[[RCTGIFImageDecoder new]];
}];
}
// No custom initializer here.
return [moduleClass new];
}
Expand Down

0 comments on commit e1395ec

Please sign in to comment.