Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ES6 Symbol polyfill for compatibility with iOS 8 and Android #5294

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ function setUpAlert() {
}
}

function setUpSymbol() {
GLOBAL.Symbol = require('es6-symbol');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we want to overwrite native Symbol if present.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e. use require('es6-symbol/implement');

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/medikoo/es6-symbol/blob/master/index.js#L3

Am I reading that wrong? It seems like it's checking for native, global Symbol before it polyfills.

Or would you rather have that check in our code?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m sorry, I misunderstood their documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidaurelio np :) If you'd rather me move the check into RN so it's more clear, I'm happy to do that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it’s good the way it is. @mkonicek will take care of merging

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks gentlemen!

}

function setUpPromise() {
// The native Promise implementation throws the following error:
// ERROR: Event loop not supported.
Expand Down Expand Up @@ -194,6 +198,7 @@ setUpProcessEnv();
setUpConsole();
setUpTimers();
setUpAlert();
setUpSymbol();
setUpPromise();
setUpErrorHandler();
setUpXHR();
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"modulePathIgnorePatterns": [
"node_modules/react/lib/React.js",
"node_modules/react/lib/ReactDOM.js",

"node_modules/fbjs/lib/Map.js",
"node_modules/fbjs/lib/Promise.js",
"node_modules/fbjs/lib/fetch.js",
Expand All @@ -48,7 +47,6 @@
"node_modules/fbjs/lib/someObject.js",
"node_modules/fbjs/lib/sprintf.js",
"node_modules/fbjs/lib/xhrSimpleDataSerializer.js",

"downstream/core/CSSCore.js",
"downstream/core/TouchEventUtils.js",
"downstream/core/camelize.js",
Expand All @@ -68,7 +66,6 @@
"downstream/core/invariant.js",
"downstream/core/nativeRequestAnimationFrame.js",
"downstream/core/toArray.js",

"node_modules/jest-cli",
"node_modules/react/dist"
],
Expand Down Expand Up @@ -109,6 +106,7 @@
"art": "^0.10.0",
"babel-core": "^6.1.20",
"babel-plugin-external-helpers-2": "^6.1.4",
"babel-plugin-react-transform": "2.0.0-beta1",
"babel-plugin-syntax-async-functions": "^6.0.14",
"babel-plugin-syntax-class-properties": "^6.0.14",
"babel-plugin-syntax-flow": "^6.0.14",
Expand Down Expand Up @@ -141,6 +139,7 @@
"chalk": "^1.1.1",
"connect": "^2.8.3",
"debug": "^2.2.0",
"es6-symbol": "^3.0.2",
"event-target-shim": "^1.0.5",
"fbjs": "^0.6.0",
"fbjs-scripts": "^0.4.0",
Expand All @@ -160,7 +159,6 @@
"react": "^0.14.5",
"react-timer-mixin": "^0.13.2",
"react-transform-hmr": "^1.0.1",
"babel-plugin-react-transform": "2.0.0-beta1",
"rebound": "^0.0.13",
"regenerator": "^0.8.36",
"sane": "^1.2.0",
Expand Down