Skip to content

Commit dd394a1

Browse files
authored
Update ViewShot.java
1 parent b0f3c3c commit dd394a1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class ViewShot implements UIBlock {
3737
private String result;
3838
private Promise promise;
3939
private Boolean snapshotContentContainer;
40+
private ReactApplicationContext reactContext;
4041

4142
public ViewShot(
4243
int tag,
@@ -48,6 +49,7 @@ public ViewShot(
4849
File output,
4950
String result,
5051
Boolean snapshotContentContainer,
52+
ReactApplicationContext reactContext,
5153
Promise promise) {
5254
this.tag = tag;
5355
this.extension = extension;
@@ -58,6 +60,7 @@ public ViewShot(
5860
this.output = output;
5961
this.result = result;
6062
this.snapshotContentContainer = snapshotContentContainer;
63+
this.reactContext = reactContext;
6164
this.promise = promise;
6265
}
6366

@@ -74,6 +77,7 @@ public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
7477
os = new FileOutputStream(output);
7578
captureView(view, os);
7679
String uri = Uri.fromFile(output).toString();
80+
reactContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(uri)));
7781
promise.resolve(uri);
7882
}
7983
else if ("base64".equals(result)) {

0 commit comments

Comments
 (0)