Skip to content

eval() function is not compatible with hermes in iOS #785

@Yandamuri

Description

@Yandamuri

Description

I have hermes enabled in my iOS project and trying to execute following code snippet,

 let testCall = () => this.testCall();
 let funct = '{() => testCall()}';   // function in string format
 let finalFunc = eval(funct);

Now, If I execute the finalFunc() then am getting following error,

Simulator Screen Shot - iPhone Xs Max - 2022-07-22 at 12 52 47

But if I I execute the finalFunc() when hermes is disabled then testCall() function is called successfully.

Note: In Android there is no issue no matter hermes is enabled or disabled.

Version

0.67

Output of npx react-native info

System:
     OS: macOS 11.6
     CPU: (8) x64 Apple M1
     Memory: 40.87 MB / 8.00 GB
     Shell: 5.8 - /bin/zsh
Binaries:
    Node: 12.22.1 - /usr/local/bin/node
    Yarn: Not Found
    npm: 6.14.12 - /usr/local/bin/npm
   Watchman: Not Found
Managers:
       CocoaPods: 1.11.2 - /opt/homebrew/bin/pod
 SDKs:
      iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
      Android SDK: Not Found
IDEs:
      Android Studio: 4.2 AI-202.7660.26.42.7351085
      Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
      Java: 11.0.10 - /usr/bin/javac
npmPackages:
      @react-native-community/cli: Not Found
      react: 17.0.2 => 17.0.2 
      react-native: 0.67.0 => 0.67.0 
      react-native-macos: Not Found
      npmGlobalPackages:
      *react-native*: Not Found

Steps to reproduce

  1. Kindly clone the reproducible demo

2.Once the project is ran you will be able to see a text called 'Button'

3.Just tap on the button then you will face the error which is in above screen shot

Snack, code example, screenshot, or link to a repository

Please find the reproducible demo here - -https://github.com/Yandamuri/Test-Hermes-In-IOS

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions