Created
June 29, 2020 12:14
-
-
Save gnarula/2a419cd1ab16cefbe5bbf5f593cc305a to your computer and use it in GitHub Desktop.
URLSearchParams react-native override
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this at the top of index.js in your react-native project | |
delete global.URLSearchParams; | |
delete global.URL; | |
const pollyfillGlobal = require('react-native/Libraries/Utilities/PolyfillFunctions').polyfillGlobal; | |
pollyfillGlobal('URL', () => require('whatwg-url').URL); | |
pollyfillGlobal('URLSearchParams', () => require('whatwg-url').URLSearchParams); | |
global.URL = require('whatwg-url').URL; | |
global.URLSearchParams = require('whatwg-url').URLSearchParams; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment