motifySvg()
A higher-order component that turns any React Native SVG component into an animated moti
component. It's the same as motify
, but for SVG elements.
You can now pass any SVG props to the animate
property, and they will animate there:
This functionality is compatible with all Moti features, including hooks like useDynamicAnimation
:
#
How it worksUnder the hood, motifySvg
runs Animated.createAnimatedComponent
for you, so don't call that yourself.
Instead, just pass a normal View
(or its equivalent).
Notice that motifySvg()
returns a function. At the moment, the function it returns doesn't take any arguments. But I like this composition pattern, so I built the API this way to account for using the returned function in the future.