Ver código fonte

Update ViewShot.java

聂先生 7 anos atrás
pai
commit
dd394a1356

+ 4
- 0
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java Ver arquivo

@@ -37,6 +37,7 @@ public class ViewShot implements UIBlock {
37 37
     private String result;
38 38
     private Promise promise;
39 39
     private Boolean snapshotContentContainer;
40
+    private  ReactApplicationContext reactContext;
40 41
 
41 42
     public ViewShot(
42 43
             int tag,
@@ -48,6 +49,7 @@ public class ViewShot implements UIBlock {
48 49
             File output,
49 50
             String result,
50 51
             Boolean snapshotContentContainer,
52
+            ReactApplicationContext reactContext,
51 53
             Promise promise) {
52 54
         this.tag = tag;
53 55
         this.extension = extension;
@@ -58,6 +60,7 @@ public class ViewShot implements UIBlock {
58 60
         this.output = output;
59 61
         this.result = result;
60 62
         this.snapshotContentContainer = snapshotContentContainer;
63
+        this.reactContext = reactContext;
61 64
         this.promise = promise;
62 65
     }
63 66
 
@@ -74,6 +77,7 @@ public class ViewShot implements UIBlock {
74 77
                 os = new FileOutputStream(output);
75 78
                 captureView(view, os);
76 79
                 String uri = Uri.fromFile(output).toString();
80
+                reactContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(uri)));
77 81
                 promise.resolve(uri);
78 82
             }
79 83
             else if ("base64".equals(result)) {