gradle clean and confirmed this bug does not occur with JSCHermes version: [email protected]
React Native version (if any): 0.63.2
Android version (if any): 10.0+ (API 30)
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86
const result = [..."aaa".matchAll(/A/g)];
Throws:
Undefined is not a function
I would expect String.prototype.matchAll to exist
In the meantime, you can use https://npmjs.com/string.prototype.matchall.
@Gregoirevda String.prototype.matchAll() was added in ES2020. We are gradually implementing features of newer spec versions, but we haven't fully caught up to ES2020 yet :-) So, we will get to it, but not sure when, especially if quality polyfills already exist.
@tmikov @Gregoirevda
Actually, Hermes had already implemented ES2020 String.prototype.matchAll and ES2021 String.prototype.replaceAll natively and they are included in Release v0.6.0.
Once the RN 0.64 is out, you can upgrade to Hermes v0.6 or v0.7 to use them natively ;)
As for RN 0.63, feel free to use the polyfill that Jordan suggested.
Most helpful comment
@tmikov @Gregoirevda
Actually, Hermes had already implemented ES2020
String.prototype.matchAlland ES2021String.prototype.replaceAllnatively and they are included in Release v0.6.0.Once the RN 0.64 is out, you can upgrade to Hermes v0.6 or v0.7 to use them natively ;)
As for RN 0.63, feel free to use the polyfill that Jordan suggested.