-
Notifications
You must be signed in to change notification settings - Fork 626
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
Support for asynchronous iterators (async for of) #551
Comments
+1 |
JavaScriptCore in iOS 12+ supports them natively, as does JavaScriptCore bundled for Android. Can you set your minimum required iOS to 12? |
any updates on this? I have also issues with getting this to work with the following error:
|
@berdyshev I was able to figure out what was going wrong. That error is due to an error in the I was able to workaround the problem by adding |
@ls-andrew-goodale, do you know the minimum requirements for Android?
but for android I receive this message: my build.gradle, if needed, is:
in app/build.gradle I have:
Thanks in advance |
@JSonicV I use a very similar Babel config and don't have that error. Unfortunately, even though the Android JavaScriptCore supports async iteration, we have to use the Babel config to workaround the bug in Is your type error coming from using a Generator or a custom Iterable? |
@ls-andrew-goodale It is from Generators, which are massively used in SocketCluster to listen and consume events.
|
Summary: **Summary** Async Generators and `for await` are part of ES2018. This PR adds `plugin-proposal-async-generator-functions` to the react native preset. See https://babeljs.io/docs/en/babel-plugin-proposal-async-generator-functions Fixes facebook#551 **Test plan** I added a test `transforms async generators` to `index-test.js`. Pull Request resolved: facebook#747 Reviewed By: motiz88 Differential Revision: D33621536 Pulled By: rh389 fbshipit-source-id: 0e07e6132e894fb5ad455627c2a33674f904a2fc
Summary: **Summary** Async Generators and `for await` are part of ES2018. This PR adds `plugin-proposal-async-generator-functions` to the react native preset. See https://babeljs.io/docs/en/babel-plugin-proposal-async-generator-functions Fixes facebook#551 **Test plan** I added a test `transforms async generators` to `index-test.js`. Pull Request resolved: facebook#747 Reviewed By: motiz88 Differential Revision: D33621536 Pulled By: rh389 fbshipit-source-id: 0e07e6132e894fb5ad455627c2a33674f904a2fc
Summary: **Summary** Async Generators and `for await` are part of ES2018. This PR adds `plugin-proposal-async-generator-functions` to the react native preset. See https://babeljs.io/docs/en/babel-plugin-proposal-async-generator-functions Fixes facebook#551 **Test plan** I added a test `transforms async generators` to `index-test.js`. Pull Request resolved: facebook#747 Reviewed By: motiz88 Differential Revision: D33621536 Pulled By: rh389 fbshipit-source-id: 0e07e6132e894fb5ad455627c2a33674f904a2fc
Hi @JSonicV have you found any solution to this? I'm also facing this issue when implementing Socket Cluster in React Native in Android |
Hi @sohan-dutta, would you be able to open a new issue describing the behaviour you’re seeing with your Babel and Metro config? I don’t think this bug is on our radar at the moment. |
I have the same problem trying to implement Socket Cluster in react native on ios/android. Did anyone figure this out? The babel config didn't help at all. EDIT: I seem to have solved it. first do the following: yarn add react-native-get-random-values
npx pod-install
yarn add -D core-js react-native-get-random-values is needed by the After installing those dependencies, you need to add this to the top of your App.tsx (before everything else):
Again, the |
I was able to solve using this polyfill @azure/core-asynciterator-polyfill |
Asynchronous iterators and generators (aka
await for ... of
) are available as part of ES2018.How can I use it in a react-native app? Currently there is no metro support for them.
Example:
Any suggestion to workaround the issue is welcome. I could not find anything for using them.
Thanks
The text was updated successfully, but these errors were encountered: