Skip to content

Commit 8ca87ce

Browse files
committed
Revert falsey view check to preserve error being thrown back to user in the case of a bad ref ID
1 parent 78ac631 commit 8ca87ce

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ios/RNViewShot.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ - (dispatch_queue_t)methodQueue
4747

4848
// Get view
4949
UIView *view;
50-
view = viewRegistry[target];
51-
BOOL nativeCapture = false;
52-
if (!view) {
50+
51+
if ([target intValue] == -1) {
5352
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
5453
view = window.rootViewController.view;
55-
nativeCapture = true;
54+
} else {
55+
view = viewRegistry[target];
5656
}
5757

5858
if (!view) {
@@ -102,7 +102,7 @@ - (dispatch_queue_t)methodQueue
102102
scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
103103
}
104104

105-
if (nativeCapture) {
105+
if ([target intValue] == -1) {
106106
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
107107
UIGraphicsBeginImageContextWithOptions(view.window.bounds.size, NO, [UIScreen mainScreen].scale);
108108
} else {

0 commit comments

Comments
 (0)