Skip to content

Conversation

@antonis
Copy link

@antonis antonis commented Oct 13, 2025

Summary

Minor refactoring to use slice().reverse() instead of toReversed() for backwards compatibility.

toReversed is an ES2023 feature not available in older JS environments, causing runtime errors in React Native projects with older Hermes versions.

This results in errors like the following

TypeError: configs.toReversed is not a function

Changelog:

Test plan

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 13, 2025
@antonis antonis marked this pull request as ready for review October 13, 2025 11:54
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 13, 2025
@meta-codesync
Copy link

meta-codesync bot commented Oct 14, 2025

@robhogan has imported this pull request. If you are a Meta employee, you can view this in D84558836.

@robhogan
Copy link
Contributor

robhogan commented Oct 14, 2025

Hi @antonis - thanks for the PR.

This code should only run on Node.js, not on the client (Hermes) - and I thought .toReversed() was supported by our minimum Node.js version. Can I ask what version you're seeing an issue with?

node.green says this is ok in 20.11: https://node.green/#ES2023-features-Change-Array-by-copy-Array-prototype-toReversed--

Metro's minimum is 20.19:

"node": ">=20.19.4"

@antonis
Copy link
Author

antonis commented Oct 14, 2025

Hello @robhogan,
thank you for iterating on this 🙇

Can I ask what version you're seeing an issue with?

I've noticed this with RN 0.81.0 on one of our E2E tests that use node 18

@robhogan
Copy link
Contributor

robhogan commented Oct 14, 2025

Ah I see - Metro and RN 0.81 has a minimum Node.js version of 20.19 so failing on Node 18 isn't a bug.

I'd recommend enforcing engines constraints with Yarn to make that clearer - maybe we can modify the template so this is the default (Yarn v1 does out of the box, but I think 2+ needs a plugin).

I'm going to close this, but thanks for raising it - we should make it more obvious for folks running on unsupported versions.

@taylorkline
Copy link

For me, the issue occurred because I still had an .xcode.env.local that pointed to an old version of Node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants