Browse Source

Replace the pointer equivalency check with a falsey check on the UIView.

Fox 7 years ago
parent
commit
78ac6311a6
1 changed files with 5 additions and 5 deletions
  1. 5
    5
      ios/RNViewShot.m

+ 5
- 5
ios/RNViewShot.m View File

47
 
47
 
48
     // Get view
48
     // Get view
49
     UIView *view;
49
     UIView *view;
50
-
51
-    if ((int)target == -1) {
50
+    view = viewRegistry[target];
51
+    BOOL nativeCapture = false;
52
+    if (!view) {
52
       UIWindow *window = [[UIApplication sharedApplication] keyWindow];
53
       UIWindow *window = [[UIApplication sharedApplication] keyWindow];
53
       view = window.rootViewController.view;
54
       view = window.rootViewController.view;
54
-    } else {
55
-      view = viewRegistry[target];
55
+      nativeCapture = true;
56
     }
56
     }
57
 
57
 
58
     if (!view) {
58
     if (!view) {
102
       scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
102
       scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
103
     }
103
     }
104
 
104
 
105
-    if ((int)target == -1) {
105
+    if (nativeCapture) {
106
       if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
106
       if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
107
         UIGraphicsBeginImageContextWithOptions(view.window.bounds.size, NO, [UIScreen mainScreen].scale);
107
         UIGraphicsBeginImageContextWithOptions(view.window.bounds.size, NO, [UIScreen mainScreen].scale);
108
       } else {
108
       } else {