mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move RCTImageLoader asserts to protect bridge usage
Summary: `RCTImageLoader ` needs loaders & decoders. These can be passed in through init, or looked up at runtime using the bridge. In bridgeless mode, we need to pass them in through init. This diff just moves the assert to actually protect `_bridge` usage, since there exist other codepaths which don't use the bridge. Changelog: [iOS][Internal] Move RCTImageLoader asserts to protect bridge usage Reviewed By: RSNara Differential Revision: D18990760 fbshipit-source-id: 285008e7b3f473c45381ab472c3d86e5d8e218ae
This commit is contained in:
committed by
Facebook Github Bot
parent
6ceef13a9c
commit
c7f7b4c87a
@@ -169,11 +169,11 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
if (!_loaders) {
|
||||
// Get loaders, sorted in reverse priority order (highest priority first)
|
||||
RCTAssert(_bridge, @"Bridge not set");
|
||||
|
||||
if (_loadersProvider) {
|
||||
_loaders = _loadersProvider();
|
||||
} else {
|
||||
RCTAssert(_bridge, @"Trying to find RCTImageURLLoaders and bridge not set.");
|
||||
_loaders = [_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)];
|
||||
}
|
||||
|
||||
@@ -233,11 +233,11 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
if (!_decoders) {
|
||||
// Get decoders, sorted in reverse priority order (highest priority first)
|
||||
RCTAssert(_bridge, @"Bridge not set");
|
||||
|
||||
if (_decodersProvider) {
|
||||
_decoders = _decodersProvider();
|
||||
} else {
|
||||
RCTAssert(_bridge, @"Trying to find RCTImageDataDecoders and bridge not set.");
|
||||
_decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user