diff --git a/index.js b/index.js index 796cb02..5be4fa1 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,15 @@ (function(self) { 'use strict'; - var nativeURLSearchParams = (self.URLSearchParams && self.URLSearchParams.prototype.get) ? self.URLSearchParams : null, + var nativeURLSearchParams = (function() { + // #41 Fix issue in RN + try { + if (self.URLSearchParams && (new self.URLSearchParams('foo=bar')).get('foo') === 'bar') { + return self.URLSearchParams; + } + } catch (e) {} + return null; + })(), isSupportObjectConstructor = nativeURLSearchParams && (new nativeURLSearchParams({a: 1})).toString() === 'a=1', // There is a bug in safari 10.1 (and earlier) that incorrectly decodes `%2B` as an empty space and not a plus. decodesPlusesCorrectly = nativeURLSearchParams && (new nativeURLSearchParams('s=%2B').get('s') === '+'), diff --git a/package.json b/package.json index 066ffad..a672eca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "url-search-params-polyfill", - "version": "8.0.0", + "version": "8.1.0", "description": "a simple polyfill for javascript URLSearchParams", "homepage": "https://github.com/jerrybendy/url-search-params-polyfill", "main": "index.js",