Skip to content

Commit 98267bb

Browse files
authored
Remove usage of RN's polyfillGlobal (#373)
1 parent 29942dd commit 98267bb

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

.circleci/config.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,19 @@ jobs:
142142
name: Lint
143143
command: yarn lint
144144
test-js:
145+
parameters:
146+
react-native-version:
147+
type: string
148+
default: ''
145149
executor: default
146150
steps:
147151
- *attach-workspace
152+
- when:
153+
condition: << parameters.react-native-version >>
154+
steps:
155+
- run:
156+
name: Overriding react-native version
157+
command: yarn add --dev react-native@<< parameters.react-native-version >>
148158
- run:
149159
name: Run Jest
150160
command: yarn test

__tests__/index-test.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
jest.mock('react-native/Libraries/Utilities/PolyfillFunctions', () => ({
2-
polyfillGlobal: jest.fn(),
3-
}));
4-
51
describe('Index', function () {
62
it("shouldn't apply URL and URLSearchParams on import", () => {
73
expect(global.REACT_NATIVE_URL_POLYFILL).toBeUndefined();

index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import './js/ios10Fix';
22

3-
import {polyfillGlobal} from 'react-native/Libraries/Utilities/PolyfillFunctions';
4-
53
import {name, version} from './package.json';
64

75
export * from './js/URL';
@@ -10,9 +8,6 @@ export * from './js/URLSearchParams';
108
export function setupURLPolyfill() {
119
global.REACT_NATIVE_URL_POLYFILL = `${name}@${version}`;
1210

13-
polyfillGlobal('URL', () => require('./js/URL').URL);
14-
polyfillGlobal(
15-
'URLSearchParams',
16-
() => require('./js/URLSearchParams').URLSearchParams,
17-
);
11+
global.URL = require('./js/URL').URL;
12+
global.URLSearchParams = require('./js/URLSearchParams').URLSearchParams;
1813
}

0 commit comments

Comments
 (0)