-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Error when using rotation transform and "useNativeDriver: true" in Android #14161
Comments
I have the same issue. RN version: v0.45.1 |
Hi there! This issue is being closed because it has been inactive for a while. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. Either way, we're automatically closing issues after a period of inactivity. Please do not take it personally! If you think this issue should definitely remain open, please let us know. The following information is helpful when it comes to determining if the issue should be re-opened:
If you would like to work on a patch to fix the issue, contributions are very welcome! Read through the contribution guide, and feel free to hop into #react-native if you need help planning your contribution. |
I can confirm this is still a bug in RN 0.48 and narrowed down to the line |
Hi, On iOS, rotate value in string format work properly but on Android, you have to use a double value like that : You can use the Platform module to detect if you are on iOS or Android : |
Hello, I have the same issue, RN 0.49.2, When trying @WemagineGuillaume soulution, it throws an error, that Transform can only accept String with 'deg' or 'rad' values. When using double value with Platform.select for android (f.ex. 4.71), the same error as from OP throws up. Note that I use it to 'static' permanent rotate. Not Animated whatsoever. |
I noticed this bug too and none of the "fixes" in this thread are not working. Using RN 0.48.4 |
Animating without |
This fixes an issue with useNativeDriver and Android. facebook/react-native#14161
This fixes an issue with useNativeDriver and Android. facebook/react-native#14161
This is due to an underlying react-native bug where strings aren't evaluated properly when using native drivers. facebook/react-native#14161
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
This is still a problem on RN 0.51 |
I have the same issue with RN 0.49 :( |
I didn't test with "rotate", but "rotateX" and "rotateY" work fine for me. Stick it into a
Here I go from 0deg to 180deg. But you can keep it constant. |
@janicduplessis I opened a PR for this here: #18872 The error that appears is |
@janicduplessis @hramos what is the process for getting this merged? Currently forces people to setNativeDriver to false. |
Yea I'm getting this too only when using |
Ouw, I could use it. It's code block like that ... |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Summary: Fixes #14161 Android crashes in some cases if an animated transform config contains a string value, like a rotation. This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js. Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted. [Android] [Fixed] - Fixes Android crash on animated style with string rotation Pull Request resolved: #18872 Differential Revision: D13894676 Pulled By: cpojer fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
Summary: Fixes #14161 Android crashes in some cases if an animated transform config contains a string value, like a rotation. This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js. Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted. [Android] [Fixed] - Fixes Android crash on animated style with string rotation Pull Request resolved: #18872 Differential Revision: D13894676 Pulled By: cpojer fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
Summary: Fixes facebook#14161 Android crashes in some cases if an animated transform config contains a string value, like a rotation. This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js. Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted. [Android] [Fixed] - Fixes Android crash on animated style with string rotation Pull Request resolved: facebook#18872 Differential Revision: D13894676 Pulled By: cpojer fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
Summary: Fixes facebook#14161 Android crashes in some cases if an animated transform config contains a string value, like a rotation. This PR fixes that by ensuring all values sent to the native side are doubles. It adds `__transformDataType` to AnimatedTransform.js. Added integration test `ReactAndroid/src/androidText/js/AnimatedTransformTestModule.js` This test fails with the following error `INSTRUMENTATION_RESULT: longMsg=java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Double`, if the changes to AnimatedTransform.js are reverted. [Android] [Fixed] - Fixes Android crash on animated style with string rotation Pull Request resolved: facebook#18872 Differential Revision: D13894676 Pulled By: cpojer fbshipit-source-id: 297e8132563460802e53f3ac551c3ba9ed943736
Description
Animation do not work on Android when
useNativeDriver
istrue
and using a rotation transform setting the its angle as aString
value. But it works as expected when setting it in radians using adouble
value. I usually set the rotation using a String as it is specified in the documentation, but in this case it crashes as it is expecting a double value.The error I am getting is the following:
Reproduction Steps and Sample Code
The following code sample would work either changing
useNativeDriver
tofalse
or setting the rotation in radians.I wrote an example in Expo as well: https://snack.expo.io/SJGbutsl-
Additional Information
The text was updated successfully, but these errors were encountered: