diff --git a/ios/GLCanvasManager.m b/ios/GLCanvasManager.m index 0ca4404d7c9c2a8015d7dbe82b62a6c6721b8718..ffa8abb37408dbbf288126611994a19c65657f1d 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 9635e2d4545b18217aa64a02c672c19ff3c065fb..9e47648593dcd95695b71814c570c1770d8e1e92 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 ab009e87c9a3f928b1d8dc3af2395ba08ecb015e..340124bd6a0189892b07556b08480b2315fb9f91 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 0f2511c3bed38254cbbad829b71fdbd0e06ad900..7c0d24479b799e9fd4a35978c1a1cd2844cf4092 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": {