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
feat: Add interpolateColors
function
#777
feat: Add interpolateColors
function
#777
Conversation
Thanks for your contribution! I wonder if we should include it directly in |
Maybe it could be included directly in I was thinking about it, but then decided: doing that is definitely more work; maybe needs to be discussed first; and still, I think it can be done later on as improvement. (And doing that improvement wouldn't break the For now I think merging this PR will be very helpful, as it'll make animating colors way easier, and also provide the docs describing how to do it. ( Currently there are none ;P ) Let me know if you want me to do some changes to the PR if anything blocks merging it, I'm happy to help. |
Also, it does fix #262 I think, at least the demo - you can see it being fixed after using the helper here: https://snack.expo.io/@jack-ailo/reanimatedcolorbugexample . |
You're right, yes. I was convinced that color is a node but it's just a few bitshifts glued together.
That's also true, I mistook it for another issue with interpolating colors as strings e.g. from "#fff" to "#000" (which can also be added in some followup) I think a minor update to docs would be awesome:
After those changes, this will be ready for merging. |
Updates to docs added ;) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Not sure if this helps but we have implemented such functions in redash: https://github.com/wcandillon/react-native-redash/blob/master/packages/core/src/Colors.ts |
I didn't know that react-native has such function as |
Actually the |
Just had a look at the diff and it looks good :) |
interpolateColors is not exported with the v1.9.0 |
It's not, it'll be included in the next version. |
Description
Lets users animate colors with
react-native-reanimated
without the need of additional helper functions like this one or this one.Also will help avoid people from running into a problem "why does this color doesn't animate? :(" like I did today in the morning in one of my projects. :)
Fixes #181 .