Skip to content

Intl library functions become undefined on iOS in React Native v0.74.x with Hermes #290

Description

@rcluca

Old Version

0.73.8

New Version

0.74.1

Description

The built-in Intl library seems to lose support on iOS with Hermes in v0.74.x, specifically methods like Intl.DateTimeFormat.formatToParts() become undefined. Android (with and without Hermes) and Web work as expected.

Steps to reproduce

  1. Install the app with yarn install and pod install in the ios repo
  2. Add a reference to the Intl library and use it, for example, add the following to the App.tsx file:
    const formatter = new Intl.DateTimeFormat(); console.log(formatter.formatToParts(new Date()));
  3. Run the app with react-native start and react-native run-ios.
  4. See the app crash when loading the App component.

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 13.6.6
  CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Memory: 102.14 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 19.4.0
    path: /usr/local/bin/node
  Yarn:
    version: 3.6.4
    path: /usr/local/bin/yarn
  npm:
    version: 9.2.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.01.16.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/raulluca/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/raulluca/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

LOG  Running "ReproducerApp" with {"rootTag":1,"initialProps":{"concurrentRoot":false}}
 ERROR  TypeError: formatter.formatToParts is not a function (it is undefined)

This error is located at:
    in Section (created by App)
    in RCTView (created by View)
    in View (created by App)
    in RCTScrollContentView (created by ScrollView)
    in RCTScrollView (created by ScrollView)
    in ScrollView (created by ScrollView)
    in ScrollView (created by App)
    in RCTSafeAreaView (created by App)
    in App
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in ReproducerApp(RootComponent), js engine: hermes

Reproducer

https://github.com/rcluca/intl-hermes

Screenshots and Videos

Error Screen

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions