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

SyntaxError: Invalid RegExp: Invalid escape, js engine: hermes #129

Closed
Albert-Gao opened this issue Jul 19, 2024 · 3 comments
Closed

SyntaxError: Invalid RegExp: Invalid escape, js engine: hermes #129

Albert-Gao opened this issue Jul 19, 2024 · 3 comments

Comments

@Albert-Gao
Copy link

Albert-Gao commented Jul 19, 2024

Bug Description

a regexp from this lib triggers this error on Hermes(React native).

// node_modules/zod-to-json-schema/dist/cjs/parsers/string.js
exports.zodPatterns = {
  // remove other codes
  emoji: RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u"),
};

image

  • "expo": "~51.0.21",
  • "react-native": "0.74.3"

Steps To Reproduce

a repo to reproduce it.

https://github.com/Albert-Gao/rn-invalid-regexp

The Expected Behavior

It should work. (Works on JSC)

More

It seems to be a Herms issue according to this: facebook/hermes#1027
So I first created an issue on the Hermes side: facebook/hermes#1460
But if it is really hard to solve on the engine side, I wonder is there a way we can tweak this regexp to make it compatible with Hermes?

@Albert-Gao
Copy link
Author

seems it will be solved in the future version of Hermes, so close this one :)

@StefanTerdell
Copy link
Owner

@Albert-Gao This is now avoided with lazy-loading. Released in 3.23.2.

@Albert-Gao
Copy link
Author

@StefanTerdell thanks, i tested, works like a charm with Hermes now :)

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