r/reactnative • u/esthor • May 28 '20
React Native Reanimated v2 Announced. Features new (easier) API for declarative, fully native animations
https://blog.swmansion.com/introducing-reanimated-2-752b913af8b316
u/maarzx_ May 28 '20
This looks great! Already looking forward to u/wcandillon's video on this.
5
2
u/JuriJurka May 29 '20
I wanted to buy his course (monthly fee), but now it's outdated or? I hope he updates it then i'll directly buy it
14
u/eveningkid May 28 '20
I think it’s great they understood how intimidating their syntax was. It’s great to make good software, it’s best when it’s easy to use
8
u/drowsap May 28 '20
Can you animate height and width over the UI thread smoothly? I know animated api won’t work with layout properties and useNativeDriver.
7
5
u/anzoni May 29 '20
Damnit, I just bought wcandillion’s classes
2
u/TheSacredBroom May 29 '20
I think he will be update the content or create new one, si it's not lost money.
3
May 28 '20
Great stuff, looking forward to the subsequent blog posts and getting a chance to integrate into my own apps!
3
3
2
2
u/JuriJurka May 29 '20
It's so awesome! One question: It's alpha. But can I still use it in my app (it's a big important project), or will it lead to bugs and so on? How much time will it take until it will be production ready (is it called beta? gamma?)?
Thanks!
1
1
u/headphonejack_90 May 29 '20
That’s exciting, but I hope they provide support to class based components.
Hooks are amazing, but it seems everything is going towards hooks, which is something I’ve been trying to understand Why for a a while.
PS: enlighten me before downvoting
1
u/MaesterWeasel May 29 '20
Aren't hooks officialy recommended by the react team? I think their docs handle the subject a bit.
It also just feels better and clearer, once you grasp the concept. Can't put my finger on it why it is so, but they make more sense to me in react and javascript. Classes don't look appealing to use anymore.
4
u/headphonejack_90 May 29 '20
I agree and I use both.
But class components still cover a lot of use cases and are very clean and clear to other devs.
Private methods and properties (for when accessing refs), clearer lifecycle methods, ComponentDidCatch, plus less error prone environment since subscriptions and timers can be instantiated without worrying about order and event loop (assuming the devs know their shit, they can unsubscribe in componentWillUnmount, just like cleaning functions in hooks), are all missing in function components paradigm.
Things like binding functions can be solved easily with decorators (e.g @autoBind) which makes it trivial for other devs that this function is a callback for an event like onPress.
Functional components and hooks are very useful as well in other cases, and that’s the reason both class and function components should be supported and considered in libraries.
To be honest, I think a big part the react community overuse some aspects over others, this I have noticed in redux for example, where some devs tend to store their entire components state in redux store, regardless if it’s gonna be used globally or not, completely disregarding local states.
I don’t know if I’m wrong, but at least, it’s still early to deprecate class components.
1
u/drewjamesandre May 30 '20
I was able to get an animation up and running in v2 alpha that took me weeks on v1. Actually I never got the animation quite right in v1... but v2 took me ~5 hours to understand and build.
The installation was fairly complex since it requires turbo modules (see the alpha installation guide) and that was on top of the required 0.62 upgrade.
So far so good! Looking forward to beta
1
u/nextriot May 30 '20
I keep getting a
build error AppDelegate.mnot found error when following the instructions. I assume it’s due to the renaming step.Did you encounter that? If so, can you share your workaround?
1
u/drewjamesandre May 30 '20
I had to search and replace all instances of `AppDelegate.m` -> `AppDelegate.mm` in the xcworkspace file. (EDIT: in the whole project actually -- can't remember if there were other instances). I would recommend referring to the diff they provided here. Let me know if this helps!
2
u/nextriot May 30 '20
Thanks a bunch. That was pretty much it. I had to go into build phases > compile sources, then remove the .m file and add the .mm file.
1
u/LinkifyBot May 30 '20
I found links in your comment that were not hyperlinked:
I did the honors for you.
delete | information | <3
28
u/LightmanXYY May 28 '20
This is huge! Finally human-friendly syntax for writing animations.