You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Creating an instance of URL like: new URL('http://facebook.com') throws an exception. #16434
Create a ReactNative project, which uses React Native 16
Try to create an instance of URL in any .js file, like this:
consturl=newURL('http://facebook.com');
Run the project
Expected Behavior
The URL to be the native URL, this one. It was working fine in React 15, but in React 16 it was replaced with something internal. We use URL to parse URLs and extract information about the hostname, port, etc. so we need this behaviour back.
Actual Behavior
An exception is thrown: Creating BlobURL objects is not supported yet.
changed the title [-]Creating an instance of URL like `new URL('http://facebook.com')` throws an exception.[/-][+]Creating an instance of URL like: `new URL('http://facebook.com')` throws an exception.[/+]on Oct 17, 2017
Reproduced with:
Environment:
OS: Windows 10
Node: 6.12.3
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
@hramos if a polyfill existing is reason enough to close this issue then I think the React Native team should deprecate the URL module and outsource it to the community as they have with others. This weird, multi-year, limbo state of the URL module is not good...
Reacted by Adam B., Jacek Nowacki, Eugene Borys, Romario Fitzgerald, Ahmed, henrylaush, Dong Wang, Fedir Ushakov, Anthony Glyadchenko, A. Faruk Acar and 35 more
Activity
[-]Creating an instance of URL like `new URL('http://facebook.com')` throws an exception.[/-][+]Creating an instance of URL like: `new URL('http://facebook.com')` throws an exception.[/+]phillbaker commentedon Nov 8, 2017
requiringthe module seemed to work for me:mloureiro commentedon Dec 20, 2017
@phillbaker what @ipeychev meant is the URL definition: https://developer.mozilla.org/en-US/docs/Web/API/URL
not a custom module
stale commentedon Feb 18, 2018
Panthro commentedon Feb 24, 2018
ck-kc commentedon Feb 25, 2018
Trenrod commentedon Feb 26, 2018
Reproduced with:
Environment:
OS: Windows 10
Node: 6.12.3
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
lxcid commentedon Mar 11, 2018
Reproduced in:
m-vdb commentedon Mar 28, 2018
Having the issue as well, so sad :(
ovy9086 commentedon Apr 3, 2018
andrenerd commentedon Apr 3, 2018
benjohnson2001 commentedon Apr 24, 2018
danlee2025 commentedon Apr 27, 2018
32 remaining items
Asday commentedon Jun 19, 2019
@satya164 Could you let me know what more information I can provide you further to my last comment?
BettyJJ commentedon Jul 5, 2019
Sad, another basic feature missing.
React sync for revisions 85d05b3...4eeee35
charpeni commentedon Nov 25, 2019
👋 You should check this out: https://github.com/charpeni/react-native-url-polyfill.
hramos commentedon Jan 30, 2020
Closing as a workaround is provided in #16434 (comment)
deps: Add `react-native-url-polyfill`.
deps: Add `react-native-url-polyfill`.
deps: Add `react-native-url-polyfill`.
Nantris commentedon Sep 18, 2021
@hramos if a polyfill existing is reason enough to close this issue then I think the React Native team should deprecate the URL module and outsource it to the community as they have with others. This weird, multi-year, limbo state of the URL module is not good...