-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
Parallax animation with new architecture Enabled cause "Loss of precision during arithmetic conversion: (long) XX.XXXX" #715
Comments
Hello, @thibaultcapelli! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're experiencing. A similar issue was discussed in a closed thread regarding the "Loss of precision during arithmetic conversion" error when using parallax animation with the new architecture enabled [1]. To resolve this, ensure that all numeric values used in the const translateY = interpolate(
value,
[-1, 0, 1],
[-size + parallaxScrollingOffset, 0, size - parallaxScrollingOffset],
);
const translateX = interpolate(
value,
[-1, 0, 1, 2],
[-size * 0.2, 0, 0, -size * 0.2],
);
const zIndex = interpolate(
value,
[-1, 0, 1, 2],
[0, size, size, 0],
Extrapolation.CLAMP,
);
const scale = interpolate(
value,
[-1, 0, 1, 2],
[
parallaxAdjacentItemScale,
parallaxScrollingScale,
parallaxScrollingScale,
parallaxAdjacentItemScale,
],
Extrapolation.CLAMP,
);
const transform = {
transform: [
{ translateY },
{ translateX },
{ perspective: 200.0 }, // Ensure this is a floating-point number
{
rotateY: `${interpolate(
value,
[-1, 0, 1, 2],
[20.0, 0.0, 0.0, 20.0], // Use floating-point numbers
Extrapolation.CLAMP,
)}deg`,
},
{
rotateZ: `${interpolate(
value,
[-1, 0, 1, 2],
[-20.0, 0.0, 0.0, -20.0], // Use floating-point numbers
Extrapolation.CLAMP,
)}deg`,
},
{ scale },
],
}; By ensuring that all numbers are treated as floating-point, you can avoid precision loss during arithmetic conversions [2]. |
We can link them, as it looks like the same issue => #712 , thanks. |
Thanks, I missed your issue. Take a look to the PR. I'm using |
I applied the patch. I can confirm that it works. Thanks for a quick solution and your lib. 👍 |
@Bekaxp @dohooo @thibaultcapelli @rdewolff @berdyshev I have updated to the below mentioned version and still face the same issue |
Describe the bug
If I use the parallax mode with new architecture enabled it cause the following issue while animation is playing.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The demo should run without error
Versions (please complete the following information):
Smartphone (please complete the following information):
References:
Related to #712
The text was updated successfully, but these errors were encountered: