|
@@ -44,6 +44,7 @@ public class ViewShot implements UIBlock {
|
44
|
44
|
private Promise promise;
|
45
|
45
|
private Boolean snapshotContentContainer;
|
46
|
46
|
private ReactApplicationContext reactContext;
|
|
47
|
+ private Activity currentActivity;
|
47
|
48
|
|
48
|
49
|
public ViewShot(
|
49
|
50
|
int tag,
|
|
@@ -56,6 +57,7 @@ public class ViewShot implements UIBlock {
|
56
|
57
|
String result,
|
57
|
58
|
Boolean snapshotContentContainer,
|
58
|
59
|
ReactApplicationContext reactContext,
|
|
60
|
+ Activity currentActivity,
|
59
|
61
|
Promise promise) {
|
60
|
62
|
this.tag = tag;
|
61
|
63
|
this.extension = extension;
|
|
@@ -67,13 +69,21 @@ public class ViewShot implements UIBlock {
|
67
|
69
|
this.result = result;
|
68
|
70
|
this.snapshotContentContainer = snapshotContentContainer;
|
69
|
71
|
this.reactContext = reactContext;
|
|
72
|
+ this.currentActivity = currentActivity;
|
70
|
73
|
this.promise = promise;
|
71
|
74
|
}
|
72
|
75
|
|
73
|
76
|
@Override
|
74
|
77
|
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
|
75
|
78
|
OutputStream os = null;
|
76
|
|
- View view = nativeViewHierarchyManager.resolveView(tag);
|
|
79
|
+ View view = null;
|
|
80
|
+
|
|
81
|
+ if (tag == -1) {
|
|
82
|
+ view = currentActivity.getWindow().getDecorView().findViewById(android.R.id.content);
|
|
83
|
+ } else {
|
|
84
|
+ view = nativeViewHierarchyManager.resolveView(tag);
|
|
85
|
+ }
|
|
86
|
+
|
77
|
87
|
if (view == null) {
|
78
|
88
|
promise.reject(ERROR_UNABLE_TO_SNAPSHOT, "No view found with reactTag: "+tag);
|
79
|
89
|
return;
|