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

React Native bug with array response #7

Closed
davidnum opened this issue Oct 4, 2018 · 7 comments
Closed

React Native bug with array response #7

davidnum opened this issue Oct 4, 2018 · 7 comments

Comments

@davidnum
Copy link
Contributor

davidnum commented Oct 4, 2018

In RN throws iterate exception [object ArrayIterator is not iterable] where response is array of objects like
[{ field: 'foo', message: 'bar' }]

I think this problem around "for...of" operator for array and its polyfill. This bug isnt reproducible for usualy browser enviroment, only for RN. Can you fix it?

@mpyw
Copy link
Owner

mpyw commented Oct 5, 2018

I'm using RN 54 and it's working now.

@davidnum
Copy link
Contributor Author

davidnum commented Oct 5, 2018

I'm using RN 54 and it's working now.

Reproducible demo:

  1. git clone https://github.com/davidnum/axios-case-converter-rn-bug.git
  2. cd axios-case-converter-rn-bug
  3. npm install
  4. react-native run-android

@mpyw
Copy link
Owner

mpyw commented Oct 5, 2018

@davidnum Thanks, I've never tested on Android, sorry... (only iOS)

@davidnum
Copy link
Contributor Author

davidnum commented Oct 5, 2018

@davidnum Thanks, I've never tested on Android, sorry... (only iOS)

Can you test it? I cant discover where from this bug comes, from RN babel setup or from your transpailed code.

@davidnum
Copy link
Contributor Author

davidnum commented Oct 9, 2018

@davidnum Thanks, I've never tested on Android, sorry... (only iOS)

Hi! This bug caused by old android jsc version in RN, ref: facebook/react-native#15902.
Solution:

if (Platform.OS === 'android') {
  global.Symbol = require('core-js/es6/symbol');
  require('core-js/fn/symbol/iterator');
}

in entry point of app, ex. index.js.
Can you update readme based on it?

@mpyw
Copy link
Owner

mpyw commented Oct 9, 2018

@davidnum Submit your PR to be a contributor! Welcome

@davidnum
Copy link
Contributor Author

davidnum commented Oct 9, 2018

#9

@davidnum davidnum closed this as completed Oct 9, 2018
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

2 participants