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 Client: Error with Android #213

Closed
chrisheninger opened this issue Jun 5, 2018 · 5 comments
Closed

React-Native Client: Error with Android #213

chrisheninger opened this issue Jun 5, 2018 · 5 comments

Comments

@chrisheninger
Copy link
Contributor

Hi @nicolodavis! 👋

I've been working on a React-Native version of matchimals.fun over the past few weeks! In the process, I discovered a bug that we've ran into before.

When we were initially writing the React-Native Client (#128)– we found that for some strange reason for...of loops weren't getting transpiled properly– and while iOS is okay– Android doesn't know how to handle them.

screen shot 2018-06-04 at 8 57 35 pm

It looks like these lines didn't exist when we first made the RN Client but need to be changed to regular for loops:
https://github.com/google/boardgame.io/blob/master/src/core/events.js#L28
https://github.com/google/boardgame.io/blob/master/src/core/events.js#L42

I can make the updates and submit a PR if that sounds like an okay change to make.

@nicolodavis
Copy link
Member

Sure!

@chrisheninger
Copy link
Contributor Author

After digging around in the source code I found that there are for of loops all over the place... not just those two spots. 😅 I'm not really comfortable making sweeping changes like that... so I found a solution that I could apply locally to my project!

It turns out that Symbol needs polyfilled for Android + iOS <= 8. (facebook/react-native#4676 (comment))

I was able to fix my React-Native project by yarn add babel-polyfill and then import "babel-polyfill"; in my index.js.

@nicolodavis
Copy link
Member

Great! I'll start fixing the for of loops anyway. Is there anything else we need to fix in the short-term or is your workaround a good enough solution for you?

@chrisheninger
Copy link
Contributor Author

👍 Excellent. My workaround is good enough for now and should work for anyone else who comes across this issue in the meantime!

@nicolodavis
Copy link
Member

I think this should no longer be a problem with newer versions of create-react-native-app. Feel free to re-open if there is anything we should be doing on our end.

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