Commit 3f2dc198 authored by Gaëtan Renaudeau's avatar Gaëtan Renaudeau

drop old RN version since 0.16 is a breaking changes

parent db5946fd
#import "GLCanvasManager.h" #import "GLCanvasManager.h"
#import "GLCanvas.h" #import "GLCanvas.h"
#import "RCTConvert+GLData.h" #import "RCTConvert+GLData.h"
#import "RCTSparseArray.h"
#import "RCTUIManager.h" #import "RCTUIManager.h"
#import "RCTLog.h" #import "RCTLog.h"
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
...@@ -32,14 +31,15 @@ RCT_EXPORT_VIEW_PROPERTY(onChange, BOOL); ...@@ -32,14 +31,15 @@ RCT_EXPORT_VIEW_PROPERTY(onChange, BOOL);
RCT_EXPORT_METHOD(capture: (nonnull NSNumber *)reactTag callback:(RCTResponseSenderBlock)callback) RCT_EXPORT_METHOD(capture: (nonnull NSNumber *)reactTag callback:(RCTResponseSenderBlock)callback)
{ {
[self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) { [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
GLCanvas *view = viewRegistry[reactTag]; UIView *view = viewRegistry[reactTag];
if (![view isKindOfClass:[GLCanvas class]]) { if (![view isKindOfClass:[GLCanvas class]]) {
RCTLog(@"expecting UIView, got: %@", view); RCTLog(@"expecting UIView, got: %@", view);
callback(@[@"view is not a GLCanvas"]); callback(@[@"view is not a GLCanvas"]);
} }
else { else {
[view capture:callback]; GLCanvas *glCanvas = (GLCanvas *)view;
[glCanvas capture:callback];
} }
}]; }];
} }
......
...@@ -75,9 +75,9 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -75,9 +75,9 @@ RCT_NOT_IMPLEMENTED(-init)
if (!_src) { if (!_src) {
[self clearImage]; [self clearImage];
} else { } else {
// Load the image (without resizing it) // Load the image (without resizing it)
if (![_src hasPrefix:@"http://"] && ![_src hasPrefix:@"https://"]) { if (![_src hasPrefix:@"http://"] && ![_src hasPrefix:@"https://"]) {
self.image = [UIImage imageNamed:_src]; self.image = [UIImage imageNamed:_src];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
...@@ -89,13 +89,14 @@ RCT_NOT_IMPLEMENTED(-init) ...@@ -89,13 +89,14 @@ RCT_NOT_IMPLEMENTED(-init)
scale:0 scale:0
resizeMode:UIViewContentModeScaleToFill resizeMode:UIViewContentModeScaleToFill
progressBlock:nil progressBlock:nil
completionBlock:^(NSError *error, id image) { completionBlock:^(NSError *error, UIImage *image) {
_loading = nil; _loading = nil;
[self clearImage]; [self clearImage];
if (error) { if (error) {
NSLog(@"Image failed to load: %@", error); NSLog(@"Image failed to load: %@", error);
} else { } 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(); if(_onload) _onload();
} }
}]; }];
......
#import "RNGLContext.h" #import "RNGLContext.h"
#import "RCTConvert.h" #import "RCTConvert.h"
#import "RCTLog.h" #import "RCTLog.h"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
"author": "Project September <tech@projectseptember.com>", "author": "Project September <tech@projectseptember.com>",
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
"react-native": ">=0.13.0 <0.16.0", "react-native": "0.16.0-rc || >=0.16.0",
"gl-react": ">= 2.0.0" "gl-react": ">= 2.0.0"
}, },
"dependencies": { "dependencies": {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment