diff --git a/detox/rn-0.60/App.js b/detox/rn-0.60/App.js
index 6150e279..d80c8f63 100644
--- a/detox/rn-0.60/App.js
+++ b/detox/rn-0.60/App.js
@@ -27,6 +27,15 @@ const App: () => React$Node = () => {
).href
}
+
+ {URL.createObjectURL({
+ data: {
+ blobId: 1,
+ offset: 32,
+ },
+ size: 64,
+ })}
+
>
);
diff --git a/detox/rn-0.60/android/app/src/main/AndroidManifest.xml b/detox/rn-0.60/android/app/src/main/AndroidManifest.xml
index 0a1b8fcf..d16ec382 100644
--- a/detox/rn-0.60/android/app/src/main/AndroidManifest.xml
+++ b/detox/rn-0.60/android/app/src/main/AndroidManifest.xml
@@ -10,6 +10,11 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
+
Detox
+ com.detox.blob
diff --git a/detox/rn-0.60/e2e/url-polyfill.spec.js b/detox/rn-0.60/e2e/url-polyfill.spec.js
index 0a49e93c..95bd5953 100644
--- a/detox/rn-0.60/e2e/url-polyfill.spec.js
+++ b/detox/rn-0.60/e2e/url-polyfill.spec.js
@@ -24,4 +24,10 @@ describe('URL Polyfill', () => {
'https://facebook.github.io/react-native/img/header_logo.png',
);
});
+
+ it('should handle test 3', async () => {
+ await expect(element(by.id('url-test-3'))).toHaveText(
+ 'blob:1?offset=32&size=64',
+ );
+ });
});
diff --git a/detox/rn-0.61/App.js b/detox/rn-0.61/App.js
index 6150e279..d80c8f63 100644
--- a/detox/rn-0.61/App.js
+++ b/detox/rn-0.61/App.js
@@ -27,6 +27,15 @@ const App: () => React$Node = () => {
).href
}
+
+ {URL.createObjectURL({
+ data: {
+ blobId: 1,
+ offset: 32,
+ },
+ size: 64,
+ })}
+
>
);
diff --git a/detox/rn-0.61/e2e/url-polyfill.spec.js b/detox/rn-0.61/e2e/url-polyfill.spec.js
index 0a49e93c..95bd5953 100644
--- a/detox/rn-0.61/e2e/url-polyfill.spec.js
+++ b/detox/rn-0.61/e2e/url-polyfill.spec.js
@@ -24,4 +24,10 @@ describe('URL Polyfill', () => {
'https://facebook.github.io/react-native/img/header_logo.png',
);
});
+
+ it('should handle test 3', async () => {
+ await expect(element(by.id('url-test-3'))).toHaveText(
+ 'blob:1?offset=32&size=64',
+ );
+ });
});
diff --git a/detox/rn-0.62/App.js b/detox/rn-0.62/App.js
index 138c5f79..4ead8cc1 100644
--- a/detox/rn-0.62/App.js
+++ b/detox/rn-0.62/App.js
@@ -27,6 +27,15 @@ const App: () => React$Node = () => {
).href
}
+
+ {URL.createObjectURL({
+ data: {
+ blobId: 1,
+ offset: 32,
+ },
+ size: 64,
+ })}
+
>
);
diff --git a/detox/rn-0.62/e2e/url-polyfill.spec.js b/detox/rn-0.62/e2e/url-polyfill.spec.js
index 0a49e93c..95bd5953 100644
--- a/detox/rn-0.62/e2e/url-polyfill.spec.js
+++ b/detox/rn-0.62/e2e/url-polyfill.spec.js
@@ -24,4 +24,10 @@ describe('URL Polyfill', () => {
'https://facebook.github.io/react-native/img/header_logo.png',
);
});
+
+ it('should handle test 3', async () => {
+ await expect(element(by.id('url-test-3'))).toHaveText(
+ 'blob:1?offset=32&size=64',
+ );
+ });
});
diff --git a/detox/rn-0.63/App.js b/detox/rn-0.63/App.js
index 138c5f79..4ead8cc1 100644
--- a/detox/rn-0.63/App.js
+++ b/detox/rn-0.63/App.js
@@ -27,6 +27,15 @@ const App: () => React$Node = () => {
).href
}
+
+ {URL.createObjectURL({
+ data: {
+ blobId: 1,
+ offset: 32,
+ },
+ size: 64,
+ })}
+
>
);
diff --git a/detox/rn-0.63/android/app/src/main/AndroidManifest.xml b/detox/rn-0.63/android/app/src/main/AndroidManifest.xml
index 0095fc84..3a1aa4a1 100644
--- a/detox/rn-0.63/android/app/src/main/AndroidManifest.xml
+++ b/detox/rn-0.63/android/app/src/main/AndroidManifest.xml
@@ -10,6 +10,11 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
+
Detox
+ com.detox.blob
diff --git a/detox/rn-0.63/e2e/url-polyfill.spec.js b/detox/rn-0.63/e2e/url-polyfill.spec.js
index 0a49e93c..95bd5953 100644
--- a/detox/rn-0.63/e2e/url-polyfill.spec.js
+++ b/detox/rn-0.63/e2e/url-polyfill.spec.js
@@ -24,4 +24,10 @@ describe('URL Polyfill', () => {
'https://facebook.github.io/react-native/img/header_logo.png',
);
});
+
+ it('should handle test 3', async () => {
+ await expect(element(by.id('url-test-3'))).toHaveText(
+ 'blob:1?offset=32&size=64',
+ );
+ });
});
diff --git a/js/URL.js b/js/URL.js
index 7337f420..720fcff7 100644
--- a/js/URL.js
+++ b/js/URL.js
@@ -1,19 +1,14 @@
-import {URL as whatwgUrl} from 'whatwg-url-without-unicode';
-
import {NativeModules} from 'react-native';
-
-const {NativeBlobModule} = NativeModules;
+import {URL as whatwgUrl} from 'whatwg-url-without-unicode';
let BLOB_URL_PREFIX = null;
-if (
- NativeBlobModule &&
- typeof NativeBlobModule.getConstants().BLOB_URI_SCHEME === 'string'
-) {
- const constants = NativeBlobModule.getConstants();
- BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':';
- if (typeof constants.BLOB_URI_HOST === 'string') {
- BLOB_URL_PREFIX += `//${constants.BLOB_URI_HOST}/`;
+const {BlobModule} = NativeModules;
+
+if (BlobModule && typeof BlobModule.BLOB_URI_SCHEME === 'string') {
+ BLOB_URL_PREFIX = BlobModule.BLOB_URI_SCHEME + ':';
+ if (typeof BlobModule.BLOB_URI_HOST === 'string') {
+ BLOB_URL_PREFIX += `//${BlobModule.BLOB_URI_HOST}/`;
}
}