From f1beeb0843a093c5626ff56730f9dba0fdebb69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Thu, 27 Apr 2017 21:23:35 +0200 Subject: [PATCH] add a preserveImages prop that allows the (iOS) impl to keep images --- ios/GLCanvas.h | 1 + ios/GLCanvas.m | 5 ++++- ios/GLCanvasManager.m | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ios/GLCanvas.h b/ios/GLCanvas.h index 1cf1874..3c4e17f 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 8ba25df..d4ab374 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 1b0bd06..bc5a05d 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 -- 2.26.2