|
@@ -94,16 +94,22 @@ RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)target
|
94
|
94
|
}
|
95
|
95
|
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
|
96
|
96
|
success = [rendered drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES];
|
|
97
|
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
98
|
+ UIGraphicsEndImageContext();
|
|
99
|
+
|
97
|
100
|
if (snapshotContentContainer) {
|
98
|
101
|
// Restore scroll & frame
|
99
|
102
|
scrollView.contentOffset = savedContentOffset;
|
100
|
103
|
scrollView.frame = savedFrame;
|
101
|
104
|
}
|
102
|
|
- UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
103
|
|
- UIGraphicsEndImageContext();
|
104
|
105
|
|
105
|
|
- if (!success || !image) {
|
106
|
|
- reject(RCTErrorUnspecified, @"Failed to capture view snapshot", nil);
|
|
106
|
+ if (!success) {
|
|
107
|
+ reject(RCTErrorUnspecified, @"The view cannot be captured. drawViewHierarchyInRect was not successful. This is a potential technical or security limitation.", nil);
|
|
108
|
+ return;
|
|
109
|
+ }
|
|
110
|
+
|
|
111
|
+ if (!image) {
|
|
112
|
+ reject(RCTErrorUnspecified, @"Failed to capture view snapshot. UIGraphicsGetImageFromCurrentImageContext() returned nil!", nil);
|
107
|
113
|
return;
|
108
|
114
|
}
|
109
|
115
|
|