Fabric: Releasing image bitmap as part of `prepareForRecycle`

Summary:
@public
When some `RCTImageComponentView` is going to be recycled, it makes sense to free an associated bitmap because it will not be reused anyways.

Reviewed By: mdvacca

Differential Revision: D8601751

fbshipit-source-id: 1318622b66460b8e5588a4420c91c516fe2b1106
This commit is contained in:
Valentin Shergin 2018-06-26 11:32:55 -07:00 committed by Facebook Github Bot
parent 97bc0c03ba
commit d629e4b0e5
1 changed files with 10 additions and 0 deletions

View File

@ -39,6 +39,8 @@ using namespace facebook::react;
return self;
}
#pragma mark - RCTComponentViewProtocol
- (void)updateProps:(SharedProps)props oldProps:(SharedProps)oldProps
{
if (!oldProps) {
@ -79,6 +81,14 @@ using namespace facebook::react;
});
}
- (void)prepareForRecycle
{
[super prepareForRecycle];
_imageView.image = nil;
}
#pragma mark - Other
- (void)setImage:(UIImage *)image
{
const auto &imageProps = *std::static_pointer_cast<const ImageProps>(_props);