diff --git a/ios/GLCanvas.h b/ios/GLCanvas.h index 1cf1874d91a6b10376a785a7441c41107527679e..3c4e17f61752927323c85143114e96f5b2b054a5 100644 --- a/ios/GLCanvas.h +++ b/ios/GLCanvas.h @@ -9,6 +9,7 @@ @property (nonatomic) BOOL autoRedraw; @property (nonatomic) BOOL eventsThrough; @property (nonatomic) BOOL visibleContent; +@property (nonatomic) BOOL preserveImages; @property (nonatomic) NSNumber *nbContentTextures; @property (nonatomic) NSNumber *renderId; @property (nonatomic) NSNumber *pixelRatio; diff --git a/ios/GLCanvas.m b/ios/GLCanvas.m index 8ba25dfca341f3a303845b2dca4643ca5d59dbf6..d4ab3745ff0084b207ef58c9559401e99d8aaf8b 100644 --- a/ios/GLCanvas.m +++ b/ios/GLCanvas.m @@ -183,7 +183,10 @@ RCT_NOT_IMPLEMENTED(-init) @autoreleasepool { NSDictionary *prevImages = _images; - NSMutableDictionary *images = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *images = + self.preserveImages + ? _images.mutableCopy + : [[NSMutableDictionary alloc] init]; GLRenderData * (^traverseTree) (GLData *data); __block __weak GLRenderData * (^weak_traverseTree)(GLData *data); diff --git a/ios/GLCanvasManager.m b/ios/GLCanvasManager.m index 1b0bd06c6665a2857b2ed7ae4d85424227855aac..bc5a05d4c9e4fda00a5a219332d7029444434e9f 100644 --- a/ios/GLCanvasManager.m +++ b/ios/GLCanvasManager.m @@ -25,6 +25,7 @@ RCT_EXPORT_MODULE(); RCT_EXPORT_VIEW_PROPERTY(nbContentTextures, NSNumber); RCT_EXPORT_VIEW_PROPERTY(autoRedraw, BOOL); +RCT_EXPORT_VIEW_PROPERTY(preserveImages, BOOL); RCT_EXPORT_VIEW_PROPERTY(data, GLData); RCT_EXPORT_VIEW_PROPERTY(renderId, NSNumber); RCT_EXPORT_VIEW_PROPERTY(pixelRatio, NSNumber); @@ -52,7 +53,7 @@ RCT_EXPORT_METHOD(capture: (nonnull NSNumber *)reactTag withConfig:(id)config) GLCanvas * v; v = [[GLCanvas alloc] initWithBridge:self.bridge]; return v; - + } @end