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

[Android] es6 Polyfills #4841

Closed
Thomas101 opened this issue Dec 17, 2015 · 16 comments
Closed

[Android] es6 Polyfills #4841

Thomas101 opened this issue Dec 17, 2015 · 16 comments
Labels
Help Wanted :octocat: Issues ideal for external contributors. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@Thomas101
Copy link
Contributor

Hey,

I've found a few es6 polyfils which behave differently to how they should on android. They work fine on iOS and work fine when you run on android with debug enabled.

var s = new Set([1,2,3]) // New set created with one item (the array). Should contain 3. Works if you pass in 3 arguments
var a = Array.from(new Set([1])) // creates an empty array rather than [1,2,3]

var m = new Map()
m.set('k', 'v')
var iter = m.keys()
iter.next() // iter.next is undefined. Same for m.values() and m.entries()

Tom

@facebook-github-bot
Copy link
Contributor

Hey Thomas101, thanks for reporting this issue!

React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.

  • If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag react-native or for more real time interactions, ask on Discord in the #react-native channel.
  • If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
  • We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!

@atom992
Copy link

atom992 commented Jan 10, 2016

+1

@christopherdro
Copy link
Contributor

/cc @satya164 @janicduplessis

@satya164
Copy link
Contributor

cc @skevy also

@satya164 satya164 self-assigned this Apr 10, 2016
@janicduplessis
Copy link
Contributor

This probably happens because we use an older version of JSC on android. There's probably a bad or missing polyfill for Map/Set/Iterator

@bsy
Copy link

bsy commented Jul 11, 2016

+1, any updates on this?

array.entries() doesn't work on android, RN 0.27.2

@satya164
Copy link
Contributor

@bsy Feel free to send a PR if this is important to you.

@mkonicek
Copy link
Contributor

Hi there! This issue is being closed because it has been inactive for a while.

But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/android-es6-polyfills

Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top

Also, if this issue is a bug, please consider sending a pull request with a fix.

@eduardojunio
Copy link

eduardojunio commented Sep 19, 2017

@Thomas101 did you found someway to workaround this issue? I'm having the same problem with TypedArrays, works perfectly on iOS, but not on Android.

"react-native": "0.47.1", "react": "16.0.0-alpha.12"

@Thomas101
Copy link
Contributor Author

@eduardojunio never got around to fixing it to be honest. Due to time constraints we just avoided using the affected methods. e.g.

const set = new Set()
const arr = [1,2,3]
arr.forEach((v) => set.add(v))

rather than new Set([1,2,3])

@eduardojunio
Copy link

@Thomas101 I managed to workaround this by including import 'core-js' in the file that is using the typed array (thanks to this issue #4676 (comment)).

@chirag04
Copy link
Contributor

i was able to replicate. reopening but feel free to send a PR

@chirag04 chirag04 reopened this Sep 19, 2017
@chirag04 chirag04 added the Help Wanted :octocat: Issues ideal for external contributors. label Sep 19, 2017
@luco
Copy link

luco commented Oct 20, 2017

@eduardojunio I couldn't fix it by adding core-js on the file. Is there any further step?
My app still crashing on for loops.

@satya164 satya164 removed their assignment Nov 27, 2017
@stale
Copy link

stale bot commented Jan 26, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 26, 2018
@stale stale bot closed this as completed Feb 2, 2018
@ericketts
Copy link

oh wise stale bot, I petition this issue being re-opened, as it is still occurring for me on react-native 0.53-rc.1 with react 16.2.0.

Also worth noting this issue is not solved by using core-js (I'm on version 2.5.3), as per this ticket of theirs zloirock/core-js#368

@jalooc
Copy link

jalooc commented Feb 12, 2018

Yes, this issue is still on - shouldn't have been closed. @chrisnojima described the source of this problem really well in zloirock/core-js#368 (comment) (seems to be a problem with babel/core-js). What's worth mentioning: it doesn't happen during remote debugging.

Just a note from my experience with this bug: In my app it's caused when using viewabilityConfigCallbackPairs in FlatList. Reverting core-js to 2.5.2 didn't help.


One more interesting observation, that may be connected to this issue, is that I get the following warnings only when not remote debugging:

  • Warning: React.createElement: type is invalid -- expected ... but got: object
    

    ^ with stack trace pointing to <Fragment>, where Fragment is imported in a legitimate way:
    import React, { PureComponent, Fragment } from 'react' (with v0.53, where fragments' support has already landed);

  • Warning: Each child in an array or iterator should have a unique "key" prop ...
    

    ^ this pointed to children of aforementioned <Fragment>.

I don't know about it, but seems a bit like other versions of packages where used during remote debugging then during non-remote debugging...

@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Help Wanted :octocat: Issues ideal for external contributors. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests