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

ProgressBar crashes app in new arch on android #4544

Open
pnthach95 opened this issue Nov 7, 2024 · 6 comments
Open

ProgressBar crashes app in new arch on android #4544

pnthach95 opened this issue Nov 7, 2024 · 6 comments

Comments

@pnthach95
Copy link

Current behaviour

In new arch android, ProgressBar crashes app when long length float value is used in progress. It works with 1/2, 1/4 but not 1/3.

Error log: Warning: Error: Exception in HostFunction: Loss of precision during arithmetic conversion: (long) 33.33333333333333

It works on iOS but you have this error in xcode log, Error while converting prop 'accessibilityValue': Loss of precision during arithmetic conversion: (long long) 33.33333333333333

Expected behaviour

ProgressBar should work with long length float value in new arch on android

How to reproduce?

  • Create new project and enable new arch
  • Run this code and press buttons
const [progress, setProgress] = useState(1);

<ProgressBar progress={progress} />
<Button
  onPress={() => {
     setProgress(1 / 2);
  }}>
  1/2 work
</Button>
<Button
  onPress={() => {
     setProgress(1 / 3);
  }}>
  1/3 not work
</Button>

Preview

Screen_Recording_20241107_141459.mp4

What have you tried so far?

Your Environment

software version
ios 18.1
android 14
react-native 0.76.1
react-native-paper 5.12.5
node 20.12.1
yarn 3.6.4
expo sdk x.x.x
@pnthach95 pnthach95 added the bug label Nov 7, 2024
@lovegaoshi
Copy link

same problem as Sharcoux/slider#102. u can just patch package the accessibilityvalur with a math. round

@duanykruger
Copy link

Uppp, same problem! I tried the solution above, but still have the same problem.

@netdown
Copy link

netdown commented Nov 16, 2024

@AlenMartinez ProgressBar expects progress value between 0 and 1.

@ThomasLaSalmonie
Copy link

Unfortunately I don't have a lot of time to investigate before next week but I face the same issue when I wanted to upgrade to expo 51 to 52. I'm using my iOS device (Iphone 14 Pro) iOS Beta 18.2

But I manage to make thing work using the props animatedValue instead of progress keep the same float (the fix using Math.round was not working for me either)
I know it's not exactly the same feature but At least the component work.

@BogiKay BogiKay self-assigned this Nov 28, 2024
@BogiKay
Copy link
Contributor

BogiKay commented Nov 28, 2024

Currently, I'm working on a new arch support and this issue going to be fixed as part of the work

linonetwo added a commit to tiddly-gittly/TidGi-Mobile that referenced this issue Nov 29, 2024
Warning: Error: Exception in HostFunction: Loss of precision during arithmetic conversion: (long long) 52.493322164093

This error is located at:
    in RCTView (created by View)
    in View (created by ProgressBar)
    in ProgressBar (created by Importer)
    in RCTView (created by View)
    in View (created by Styled(View))
    in Styled(View) (created by Importer)
    in Importer (created by SceneView)
    in StaticContainer

callstack/react-native-paper#4544
facebook/react-native#47635
@mmuminovic
Copy link

Hi guys

Here is a fix: #4568

Please @BogiKay review it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants