Skip to content

[0.76] AccessibilityValue in View throws exception: "Exception in HostFunction: Loss of precision during arithmetic conversion: (long) "  #47635

@vincicat

Description

@vincicat

Description

Similar to react-native-elements/react-native-elements#3955 Sharcoux/slider#102 callstack/react-native-paper#4544, when any non-zero value is given to AccessibilityValue.now on Android & iOS, conversion occurs and an exception will be thrown.

(remark: Using Math.round() to avoid any (long) value will fix the issue temporarily.)

Both Expo (0.52) and bare React Native App (0.76.1 + SDK 34, 0.76.2 + SDK 35) can reproduce the bug. Expo 0.51 will not, so it is very likely related to New Architecture.

Same issue found in iOS 18 in some cases, but expo demo can show that

Steps to reproduce

  1. go to demo
  2. switch to Android/iOS and make sure expo == 0.52
  3. click "Start Progress" to see the crash

React Native Version

0.76.2

Affected Platforms

Runtime - Android
Runtime - iOS

Areas

Fabric - The New Renderer

Output of npx react-native info

Binaries:
  Node:
    version: 23.1.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 3.6.4
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2024.11.04.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12550806
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: 0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

Android:

Exception in HostFunction: Loss of precision during arithmetic conversion: (long) 0.00001

iOS:

Exception in HostFunction: Loss of precision during arithmetic conversion: (long long) 0.00001

Reproducer

https://snack.expo.dev/OEofab5meHPozAXyOQg6_

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    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