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

adds type checking to Animated toValue and iterations key values to m… #23812

Conversation

Projects
None yet
6 participants
@andrewschenk-linx
Copy link
Contributor

commented Mar 7, 2019

…ake sure Android does not crash from bad params when using useNativeDriver

Summary

Android apps crash when using Animated useNativeDriver: true and the toValue is not a number. See issue here with test case. Issue

Changelog

[Android] [fixed] - Fix crash when using Animated with useNativeDriver and a non Number toValue

Test Plan

Run Snack code with patched React Native core. Malformed parameters will no longer crash Android app.

adds type checking to Animated toValue and iterations key values to m…
…ake sure Android does not crash from bad params when using useNativeDriver

andrewschenk-linx added some commits Mar 7, 2019

@matthargett

This comment has been minimized.

Copy link
Collaborator

commented Mar 9, 2019

Should we show a warning in dev mode when this is the case? It a user has a bug in their JS, they may get confused when zeroes end up getting used silently.

@andrewschenk-linx

This comment has been minimized.

Copy link
Contributor Author

commented Mar 9, 2019

My motivation for fixing this is that the JS bug is in one of possibly 100 different dependency libraries. Showing a warning might help focus attention on which library is the culprit or where in the internal project code the developer went awry. On the other hand, it might be another yellow box warning that gets silenced because the 3rd party lib is unsupported and the developer is tired of getting nagged about it.

Personally, I would probably want to see a warning and have the option of silencing it or fixing the library.

@AndrewSchenk

This comment has been minimized.

Copy link

commented Mar 10, 2019

The JavaScript animated version does not show a yellow box warning if you supply an invalid type. i.e.

toValue: null,
useNativeDriver: false

So to maintain parity between JS and native it would be best to not show a yellow box.

@cpojer

cpojer approved these changes Mar 13, 2019

Copy link
Contributor

left a comment

Nice, thank you!

@facebook-github-bot
Copy link

left a comment

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 13, 2019

This pull request was successfully merged by @andrewschenk-linx in 25d3976.

When will my fix make it into a release? | Upcoming Releases

@andrewschenk-linx andrewschenk-linx deleted the andrewschenk-linx:Animated-useNativeDriver-fix-to-Value branch Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.