mirror of
https://github.com/status-im/react-native.git
synced 2025-02-23 22:58:19 +00:00
Summary: The biggest change is that (1) the image proxy/observer code from the Image component has been generalized, (2) the four image props for the Slider component are fully supported, (3) a handful of props that were ignored or buggy on iOS now perform as expected. Reviewed By: shergin Differential Revision: D13954892 fbshipit-source-id: bec8ad3407c39a1cb186d9541a73b509dccc92ce
42 lines
1.2 KiB
Plaintext
42 lines
1.2 KiB
Plaintext
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTImageResponseObserverProxy.h"
|
|
|
|
#import <react/imagemanager/ImageResponseObserver.h>
|
|
#import <react/imagemanager/ImageResponse.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
RCTImageResponseObserverProxy::RCTImageResponseObserverProxy(void* delegate): delegate_((__bridge id<RCTImageResponseDelegate>)delegate) {}
|
|
|
|
void RCTImageResponseObserverProxy::didReceiveImage(const ImageResponse &imageResponse) {
|
|
UIImage *image = (__bridge UIImage *)imageResponse.getImage().get();
|
|
void *this_ = this;
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[delegate_ didReceiveImage:image fromObserver:this_];
|
|
});
|
|
}
|
|
|
|
void RCTImageResponseObserverProxy::didReceiveProgress (float p) {
|
|
void *this_ = this;
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[delegate_ didReceiveProgress:p fromObserver:this_];
|
|
});
|
|
}
|
|
|
|
void RCTImageResponseObserverProxy::didReceiveFailure() {
|
|
void *this_ = this;
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[delegate_ didReceiveFailureFromObserver:this_];
|
|
});
|
|
}
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|