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

Warning: Error: Exception in HostFunction: Loss of precision during arithmetic conversion: (long) 0.01 #2600

Open
neeteshraj opened this issue Jan 4, 2025 · 10 comments
Assignees
Labels
Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@neeteshraj
Copy link

Description

(NOBRIDGE) ERROR Warning: Error: Exception in HostFunction: Loss of precision during arithmetic conversion: (long) 0.01

This error is located at:
in RNSScreen (created by Animated(Anonymous))
in Animated(Anonymous)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze
in InnerScreen (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in RNSScreenStack (created by ScreenStack)
in Unknown (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RCTView (created by View)
in View (created by SafeAreaProviderCompat)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in PreventRemoveProvider (created by NavigationContent)
in NavigationContent
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (created by ApplicationNavigator)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by ApplicationNavigator)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by ApplicationNavigator)
in ApplicationNavigator (created by Root)
in ThemeProvider (created by Root)
in ThemeProvider (created by PaperProvider)
in RCTView (created by View)
in View (created by Portal.Host)
in Portal.Host (created by PaperProvider)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaInsetsContext)
in SafeAreaProviderCompat (created by PaperProvider)
in PaperProvider (created by Root)
in RNGestureHandlerRootView (created by GestureHandlerRootView)
in GestureHandlerRootView (created by Root)
in Root
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in nkcc_mobile_app(RootComponent)

Steps to reproduce
Install react native 0.76.5
install these dependencies
"@react-native-masked-view/masked-view": "^0.3.2",
"@react-navigation/bottom-tabs": "^6.6.1",
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^6.4.1",
"i18next": "^24.2.0",
"intl-pluralrules": "^2.0.1",
"ky": "^1.7.4",
"lottie-react-native": "^7.1.0",
"react": "18.3.1",
"react-error-boundary": "^5.0.0",
"react-i18next": "^15.4.0",
"react-native": "0.76.5",
"react-native-bootsplash": "^6.3.2",
"react-native-gesture-handler": "^2.21.2",
"react-native-linear-gradient": "^2.8.3",
"react-native-mmkv": "^3.2.0",
"react-native-paper": "^5.12.5",
"react-native-reanimated": "^3.16.6",
"react-native-safe-area-context": "^5.0.0",
"react-native-screens": "4.4.0",
"react-native-svg": "^15.10.1",
"react-native-video": "^6.8.2",
"react-native-vision-camera": "^4.6.3",
"zod": "^3.24.1"

Steps to reproduce

  1. Create a new react native project.
  2. Install react navigation and native stack along with other required dependenices.
  3. Run the app on android.

Snack or a link to a repository

https://github.com/neeteshraj/nkcc/tree/feat/home-screen

Screens version

4.0.0

React Native version

0.76.5

Platforms

Android, iOS

JavaScript runtime

Hermes

Workflow

None

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

Android emulator

Device model

Galaxy S10

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS labels Jan 4, 2025
@kkafar
Copy link
Member

kkafar commented Jan 7, 2025

@neeteshraj Thanks for reporting, however the reproduction you posted is not accessible (most likely private repo, or the repo does not exist). I've also never seen the issue when running an app, therefore the reproduction steps are not valid. Please provide us with some more information, so that we can actually locate the issue / reproduce it.

If you're familiar with Android Studio you can try running the app through it & inspecting the stack trace printed at the moment of crash, most likely there will be much more of useful information there (including the line at which the error had been thrown).

@kkafar kkafar added the Close when stale This issue is going to be closed when there is no activity for a while label Jan 7, 2025
@kkafar kkafar self-assigned this Jan 7, 2025
@renopp
Copy link

renopp commented Jan 9, 2025

the error looks similar to my case after upgrade "react-native-screens": "4.4.0", but after going back to "react-native-screens": "3.35.0" seems like normal

I still figuring out how to replicate it in a clean project repo

  • "react-native": "0.76.5",
  • "react-native-screens": "4.4.0"
  • "@react-navigation/bottom-tabs": "7.2.0"
  • "@react-navigation/elements": "2.2.5"
  • "@react-navigation/native": "7.0.14"
  • "@react-navigation/stack": "7.1.1"

Screenshot_2025-01-09-15-49-31-136_com kumparan

@github-actions github-actions bot removed the Close when stale This issue is going to be closed when there is no activity for a while label Jan 9, 2025
@kkafar
Copy link
Member

kkafar commented Jan 9, 2025

@renopp do you happen to have access to native stacktrace?

@aurangs7
Copy link

I am getting the same issue in Android, I am on react-native "0.76.5"
iOS is working fine, there is no clue to fix this in the logs.
Any help will be appreciated

@kkafar
Copy link
Member

kkafar commented Jan 20, 2025

@aurangs7 would you be able to provide us with reproduction?

@aurangs7
Copy link

Hi @kkafar
I managed to fix it with this code:

I am using unit.scale function to set height, width, margin and padding in style to make it responsive.
for example:

width: unit.scale(10) // or height, margin, padding

It was working fine earlier but after updating the react-native version, it started giving error in Android only.

Image

@kkafar
Copy link
Member

kkafar commented Jan 21, 2025

@aurangs7 that's great! Let me confirm: after applying the diff you showed the error no longer happens without any changes to react-native-screens code?

@aurangs7
Copy link

Yes @kkafar
I did nothing with react-native-screens
Just changed line 6

@kkafar
Copy link
Member

kkafar commented Jan 21, 2025

Thanks!

@neeteshraj, @renopp please see the discussion above 👆🏻

Maybe it's something you can incorporate to fix the issue?

@sanduluca
Copy link

I got the same issue after upgrading the libraries.

Image

package.json diff
diff --git a/package.json b/package.json
index e93e574..3ea9142 100644
--- a/package.json
+++ b/package.json
@@ -29,101 +29,106 @@
     "lint:ts": "tsc --skipLibCheck --noEmit",
     "lint-staged": "lint-staged",
     "uninstall:android": "adb uninstall md.casahub; true",
-    "uninstall:ios": "echo 'Script not yet added.'",
-    "postinstall": "react-native setup-ios-permissions"
+    "uninstall:ios": "echo 'Script not yet added.'"
   },
   "dependencies": {
-    "@gorhom/bottom-sheet": "^4.4.7",
+    "@gorhom/bottom-sheet": "^5.0.6",
     "@invertase/react-native-apple-authentication": "^2.3.0",
-    "@livekit/react-native": "^2.4.2",
-    "@livekit/react-native-webrtc": "^125.0.4",
-    "@notifee/react-native": "^7.8.0",
-    "@react-native-clipboard/clipboard": "^1.14.1",
-    "@react-native-firebase/analytics": "^17.5.0",
-    "@react-native-firebase/app": "^17.5.0",
-    "@react-native-firebase/crashlytics": "^17.5.0",
-    "@react-native-firebase/messaging": "^17.5.0",
-    "@react-native-google-signin/google-signin": "^10.1.0",
+    "@livekit/react-native": "^2.5.1",
+    "@livekit/react-native-webrtc": "^125.0.7",
+    "@notifee/react-native": "^9.1.8",
+    "@react-native-clipboard/clipboard": "^1.16.1",
+    "@react-native-firebase/analytics": "^21.7.1",
+    "@react-native-firebase/app": "^21.7.1",
+    "@react-native-firebase/crashlytics": "^21.7.1",
+    "@react-native-firebase/messaging": "^21.7.1",
+    "@react-native-google-signin/google-signin": "^13.1.0",
     "@react-native-voice/voice": "https://github.com/react-native-voice/voice.git#master",
-    "@react-navigation/bottom-tabs": "^6.5.8",
-    "@react-navigation/drawer": "^6.6.3",
-    "@react-navigation/material-top-tabs": "^6.6.3",
-    "@react-navigation/native": "^6.1.7",
-    "@react-navigation/native-stack": "^6.9.13",
-    "@react-navigation/stack": "^6.3.17",
+    "@react-navigation/bottom-tabs": "^7.2.0",
+    "@react-navigation/drawer": "^7.1.1",
+    "@react-navigation/material-top-tabs": "^7.1.0",
+    "@react-navigation/native": "^7.0.14",
+    "@react-navigation/native-stack": "^7.2.0",
+    "@react-navigation/stack": "^7.1.1",
     "@reduxjs/toolkit": "^1.9.5",
     "@shopify/restyle": "^2.4.2",
     "@tanstack/query-async-storage-persister": "^4.33.0",
     "@tanstack/react-query": "^4.33.0",
     "@tanstack/react-query-persist-client": "^4.33.0",
-    "axios": "^1.4.0",
+    "axios": "^1.7.9",
     "html-entities": "^2.4.0",
     "i18next": "^22.5.1",
     "i18next-http-backend": "^2.2.1",
     "intl-pluralrules": "^2.0.1",
     "jwt-decode": "^3.1.2",
-    "react": "18.2.0",
+    "react": "18.3.1",
     "react-i18next": "^12.3.1",
-    "react-native": "0.71.19",
+    "react-native": "0.76.6",
     "react-native-base64": "^0.2.1",
-    "react-native-branch": "^6.2.1",
-    "react-native-circular-progress": "^1.3.9",
+    "react-native-branch": "^6.4.0",
+    "react-native-circular-progress": "^1.4.1",
     "react-native-circular-progress-indicator": "^4.4.2",
-    "react-native-device-info": "^10.8.0",
+    "react-native-device-info": "^14.0.2",
     "react-native-document-picker": "^9.3.0",
-    "react-native-element-dropdown": "^2.9.0",
+    "react-native-element-dropdown": "^2.12.4",
     "react-native-fast-image": "^8.6.3",
-    "react-native-fbsdk-next": "^12.1.1",
+    "react-native-fbsdk-next": "^13.4.0",
     "react-native-files-viewer": "^1.0.7",
     "react-native-fs": "^2.20.0",
-    "react-native-gesture-handler": "^2.12.1",
-    "react-native-iap": "^12.10.8",
-    "react-native-image-picker": "^5.6.1",
+    "react-native-gesture-handler": "^2.22.0",
+    "react-native-iap": "^12.16.0",
+    "react-native-image-picker": "^7.2.3",
     "react-native-keyboard-aware-scroll-view": "^0.9.5",
-    "react-native-localize": "^3.0.2",
+    "react-native-localize": "^3.4.1",
     "react-native-markdown-display": "^7.0.2",
-    "react-native-mmkv": "^2.10.1",
+    "react-native-mmkv": "^3.2.0",
     "react-native-modal": "^13.0.1",
-    "react-native-notificated": "^0.1.5",
-    "react-native-page-indicator": "^2.2.1",
-    "react-native-pager-view": "^6.2.0",
-    "react-native-permissions": "^3.8.4",
-    "react-native-pie-chart": "^3.0.1",
+    "react-native-notificated": "^0.1.7",
+    "react-native-page-indicator": "^2.4.1",
+    "react-native-pager-view": "^6.7.0",
+    "react-native-permissions": "^5.2.3",
+    "react-native-pie-chart": "^4.0.0",
     "react-native-progress": "^5.0.0",
-    "react-native-reanimated": "3.4.2",
-    "react-native-reanimated-carousel": "^4.0.0-canary.22",
-    "react-native-safe-area-context": "^4.7.1",
-    "react-native-screens": "^3.24.0",
-    "react-native-simple-toast": "^1.1.4",
+    "react-native-reanimated": "3.16.7",
+    "react-native-reanimated-carousel": "^3.5.1",
+    "react-native-safe-area-context": "^5.1.0",
+    "react-native-screens": "^4.5.0",
+    "react-native-simple-toast": "^3.3.2",
     "react-native-splash-screen": "^3.3.0",
-    "react-native-svg": "^13.11.0",
-    "react-native-tab-view": "^3.5.2",
+    "react-native-svg": "^15.11.1",
+    "react-native-tab-view": "^4.0.5",
     "react-native-tts": "^4.1.1",
-    "react-redux": "^8.1.2",
+    "react-redux": "^9.2.0",
     "redux-persist": "^6.0.0",
     "striptags": "^3.2.0"
   },
-  "reactNativePermissionsIOS": [
-    "Notifications"
-  ],
   "devDependencies": {
-    "@babel/core": "^7.22.10",
-    "@babel/preset-env": "^7.22.10",
-    "@babel/runtime": "^7.22.10",
+    "@babel/core": "^7.25.2",
+    "@babel/preset-env": "^7.25.3",
+    "@babel/runtime": "^7.25.0",
+    "@react-native-community/cli": "15.1.3",
+    "@react-native-community/cli-platform-android": "15.1.3",
+    "@react-native-community/cli-platform-ios": "15.1.3",
     "@react-native-community/eslint-config": "^3.2.0",
+    "@react-native/babel-preset": "0.76.6",
+    "@react-native/eslint-config": "0.76.6",
+    "@react-native/metro-config": "0.76.6",
+    "@react-native/typescript-config": "0.76.6",
     "@tsconfig/react-native": "^3.0.2",
-    "@types/jest": "^29.5.3",
-    "@types/react": "^18.2.20",
+    "@types/jest": "^29.5.14",
+    "@types/react": "^18.2.6",
     "@types/react-native-base64": "^0.2.0",
     "@types/react-test-renderer": "^18.0.0",
-    "babel-jest": "^29.6.2",
+    "babel-jest": "^29.6.3",
     "babel-plugin-module-resolver": "^5.0.0",
     "eslint": "^8.47.0",
-    "jest": "^29.6.2",
-    "metro-react-native-babel-preset": "0.73.10",
-    "prettier": "^2.8.8",
-    "react-test-renderer": "18.2.0",
-    "typescript": "4.8.4"
+    "jest": "^29.6.3",
+    "prettier": "2.8.8",
+    "react-test-renderer": "18.3.1",
+    "typescript": "5.7.3"
+  },
+  "engines": {
+    "node": ">=18"
   },
   "typeCoverage": {
     "atLeast": 80,
@@ -134,16 +139,5 @@
     "app/**/*.{js,ts,jsx,tsx,mjs,cjs,json}": [
       "prettier --write"
     ]
-  },
-  "jest": {
-    "preset": "react-native",
-    "moduleFileExtensions": [
-      "ts",
-      "tsx",
-      "js",
-      "jsx",
-      "json",
-      "node"
-    ]
   }
 }

The issue actually was coming from react-native-reanimated-carousel
dohooo/react-native-reanimated-carousel#754

The fix was to round the zIndex: Math.round(zIndex)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: Android This issue is specific to Android Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

No branches or pull requests

5 participants