-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Animated.Value.interpolate
results in NaN
when output is in radians
#36608
Comments
Is this happening on both iOS and Android? Can you provide a failing test in https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Animated/__tests__/Interpolation-test.js that exposes this? We have a test similar to this use-case which passes:
Or is this happening at a later layer where we convert degrees into radians? |
It's happening on both Android and iOS. I'm not sure at what point exactly it breaks, but it works when |
Summary: This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Differential Revision: D44406034 fbshipit-source-id: ea95f557d594a1f55bedd7c5e3a95ef36bc68ff2
Summary: Pull Request resolved: facebook#36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: 23d90b7e25a502a705c7e74fd9b939f86b1ff93e
Summary: Pull Request resolved: facebook#36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: c821d573d69b3a2111cd846a94d8a00b1b9227ed
Summary: Pull Request resolved: facebook#36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: ea0eec9421b91d200024371696d4d2406a4f8767
Summary: Pull Request resolved: #36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue #36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
Looks like it just missed inclusion in 0.72.0-RC0. |
Hey @j-piasecki it's working fine for me on both ios and android. correction: I was able to reproduce on 0.72.0-rc.0. Why was the PR closed without merge? cc: @javache |
By default we only merge to master, if you think a fix should be merged in the RC, please comment in the release thread: reactwg/react-native-releases#54 |
Summary: Pull Request resolved: facebook#36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
Summary: Pull Request resolved: facebook#36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue facebook#36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
Summary: Pull Request resolved: #36645 This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here. Instead, handle both `deg` and `rad` explicitly when generating the config in JS. Resolves issue #36608 Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians Reviewed By: yungsters Differential Revision: D44406034 fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
Description
When
Animated.Value.interpolate
is used with radians as the output units, like so:it returns
NaN
instead of the correct values.It happens on both, the old and the new architecture.
React Native Version
0.72.0-rc.0
Output of
npx react-native info
Steps to reproduce
Use the code below. It uses degrees to show how it should look, replace
outputRange: ['0deg', '360deg']
with the version commented out to see it broken.Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: