|
|
|
|
94
|
}
|
94
|
}
|
95
|
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
|
95
|
UIGraphicsBeginImageContextWithOptions(size, NO, 0);
|
96
|
success = [rendered drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES];
|
96
|
success = [rendered drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES];
|
|
|
97
|
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
|
98
|
+ UIGraphicsEndImageContext();
|
|
|
99
|
+
|
97
|
if (snapshotContentContainer) {
|
100
|
if (snapshotContentContainer) {
|
98
|
// Restore scroll & frame
|
101
|
// Restore scroll & frame
|
99
|
scrollView.contentOffset = savedContentOffset;
|
102
|
scrollView.contentOffset = savedContentOffset;
|
100
|
scrollView.frame = savedFrame;
|
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
|
return;
|
113
|
return;
|
108
|
}
|
114
|
}
|
109
|
|
115
|
|