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

"for in" and "for of" loops break React Native Android code #73

Open
joncursi opened this issue Sep 11, 2017 · 5 comments
Open

"for in" and "for of" loops break React Native Android code #73

joncursi opened this issue Sep 11, 2017 · 5 comments

Comments

@joncursi
Copy link

This repository contains several instances of for in and for of which breaks code execution on React Native Android apps.

Example: https://github.com/orionsoft/meteor-apollo-accounts/blob/3ce4f66b6cf294a96bb9d4c20d4ee43ecbb0a1be/client/src/store.js#L40

Attempting to login with password on android causes this error:

09-11 18:09:31.440  3541  3584 I ReactNativeJS: { [TypeError: undefined is not a function (evaluating 'onChangeCallbacks[typeof Symbol === 'function' ? Symbol.iterator : '@@iterator']()')]

See a similar issue logged in the css-to-react-native repo: styled-components/css-to-react-native#31 - the problem was solved by eliminating these special loops in favor of more standard ES5 code.

@joncursi
Copy link
Author

More explanation here: facebook/react-native#4676 (comment)

@acomito
Copy link

acomito commented Oct 3, 2017

Is this what is breaking the logout on android? @joncursi

@joncursi
Copy link
Author

@acomito Yeah, this library doesn't really work on React Native android devices due to Android not natively supporting Symbol. You can polyfill it with core-js though:

// index.android.js
import 'core-js/es6/symbol';
import 'core-js/fn/symbol/iterator';

But beware, doing so seems to cause other issues.

@ujwal-setlur
Copy link

@joncursi, I used the proposed solution at:

facebook/react-native#4676 (comment)

@ujwal-setlur
Copy link

This will fail on react-native 0.56.0. It will trigger

facebook/react-native#18542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants