From 3f2dc198713212c1aa9fc6827df1689cba13b748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Fri, 4 Dec 2015 10:55:24 +0100 Subject: [PATCH] drop old RN version since 0.16 is a breaking changes --- ios/GLCanvasManager.m | 8 ++++---- ios/GLImage.m | 9 +++++---- ios/RNGLContext.m | 1 - package.json | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ios/GLCanvasManager.m b/ios/GLCanvasManager.m index 0ca4404..ffa8abb 100644 --- a/ios/GLCanvasManager.m +++ b/ios/GLCanvasManager.m @@ -1,7 +1,6 @@ #import "GLCanvasManager.h" #import "GLCanvas.h" #import "RCTConvert+GLData.h" -#import "RCTSparseArray.h" #import "RCTUIManager.h" #import "RCTLog.h" #import @@ -32,14 +31,15 @@ RCT_EXPORT_VIEW_PROPERTY(onChange, BOOL); RCT_EXPORT_METHOD(capture: (nonnull NSNumber *)reactTag callback:(RCTResponseSenderBlock)callback) { - [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) { - GLCanvas *view = viewRegistry[reactTag]; + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { + UIView *view = viewRegistry[reactTag]; if (![view isKindOfClass:[GLCanvas class]]) { RCTLog(@"expecting UIView, got: %@", view); callback(@[@"view is not a GLCanvas"]); } else { - [view capture:callback]; + GLCanvas *glCanvas = (GLCanvas *)view; + [glCanvas capture:callback]; } }]; } diff --git a/ios/GLImage.m b/ios/GLImage.m index 9635e2d..9e47648 100644 --- a/ios/GLImage.m +++ b/ios/GLImage.m @@ -75,9 +75,9 @@ RCT_NOT_IMPLEMENTED(-init) if (!_src) { [self clearImage]; } else { - + // Load the image (without resizing it) - + if (![_src hasPrefix:@"http://"] && ![_src hasPrefix:@"https://"]) { self.image = [UIImage imageNamed:_src]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -89,13 +89,14 @@ RCT_NOT_IMPLEMENTED(-init) scale:0 resizeMode:UIViewContentModeScaleToFill progressBlock:nil - completionBlock:^(NSError *error, id image) { + completionBlock:^(NSError *error, UIImage *image) { _loading = nil; [self clearImage]; if (error) { NSLog(@"Image failed to load: %@", error); } else { - self.image = image; + // we need to copy the image because it seems the image will be altered. + self.image = [UIImage imageWithCGImage:image.CGImage]; if(_onload) _onload(); } }]; diff --git a/ios/RNGLContext.m b/ios/RNGLContext.m index ab009e8..340124b 100644 --- a/ios/RNGLContext.m +++ b/ios/RNGLContext.m @@ -1,6 +1,5 @@ #import "RNGLContext.h" - #import "RCTConvert.h" #import "RCTLog.h" diff --git a/package.json b/package.json index 0f2511c..7c0d244 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "Project September ", "license": "MIT", "peerDependencies": { - "react-native": ">=0.13.0 <0.16.0", + "react-native": "0.16.0-rc || >=0.16.0", "gl-react": ">= 2.0.0" }, "dependencies": { -- 2.26.2