Skip to content

Commit 6160f00

Browse files
authored
Update BlobModule usage to supported latest versions (#479)
1 parent a837938 commit 6160f00

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

js/URL.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import {URL as whatwgUrl} from 'whatwg-url-without-unicode';
33

44
let BLOB_URL_PREFIX = null;
55

6-
const {BlobModule} = NativeModules;
6+
const NativeBlobModule = NativeModules.BlobModule;
77

8-
if (BlobModule && typeof BlobModule.BLOB_URI_SCHEME === 'string') {
9-
BLOB_URL_PREFIX = BlobModule.BLOB_URI_SCHEME + ':';
10-
if (typeof BlobModule.BLOB_URI_HOST === 'string') {
11-
BLOB_URL_PREFIX += `//${BlobModule.BLOB_URI_HOST}/`;
8+
if (
9+
NativeBlobModule &&
10+
typeof NativeBlobModule.getConstants().BLOB_URI_SCHEME === 'string'
11+
) {
12+
const constants = NativeBlobModule.getConstants();
13+
BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':';
14+
if (typeof constants.BLOB_URI_HOST === 'string') {
15+
BLOB_URL_PREFIX += `//${constants.BLOB_URI_HOST}/`;
1216
}
1317
}
1418

15-
/**
19+
/*
1620
* To allow Blobs be accessed via `content://` URIs,
1721
* you need to register `BlobProvider` as a ContentProvider in your app's `AndroidManifest.xml`:
1822
*

0 commit comments

Comments
 (0)