Skip to content

Commit cebc2c9

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Do not switch queues if not necessary
Summary: Changelog: [Internal] Switching queue here is not necessary if we are already on the main queue. This is important for Fabric SSTs, otherwise images are missing. Reviewed By: shergin Differential Revision: D19907908 fbshipit-source-id: 52e82484afc8e2f591d0c5cc126952990d992e96
1 parent 5aae380 commit cebc2c9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

React/Fabric/RCTImageResponseObserverProxy.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import "RCTImageResponseObserverProxy.h"
99

10+
#import <React/RCTUtils.h>
1011
#import <react/imagemanager/ImageResponse.h>
1112
#import <react/imagemanager/ImageResponseObserver.h>
1213
#import <react/utils/ManagedObjectWrapper.h>
@@ -24,7 +25,7 @@
2425
UIImage *image = (UIImage *)unwrapManagedObject(imageResponse.getImage());
2526
id<RCTImageResponseDelegate> delegate = delegate_;
2627
auto this_ = this;
27-
dispatch_async(dispatch_get_main_queue(), ^{
28+
RCTExecuteOnMainQueue(^{
2829
[delegate didReceiveImage:image fromObserver:this_];
2930
});
3031
}
@@ -33,7 +34,7 @@
3334
{
3435
auto this_ = this;
3536
id<RCTImageResponseDelegate> delegate = delegate_;
36-
dispatch_async(dispatch_get_main_queue(), ^{
37+
RCTExecuteOnMainQueue(^{
3738
[delegate didReceiveProgress:progress fromObserver:this_];
3839
});
3940
}
@@ -42,7 +43,7 @@
4243
{
4344
auto this_ = this;
4445
id<RCTImageResponseDelegate> delegate = delegate_;
45-
dispatch_async(dispatch_get_main_queue(), ^{
46+
RCTExecuteOnMainQueue(^{
4647
[delegate didReceiveFailureFromObserver:this_];
4748
});
4849
}

0 commit comments

Comments
 (0)