How would you approach animating with Restyle?
selbekk opened this issue Β· comments
I love Restyle, and we're basing our component library on it. However, how do you go about implementing animations? I couldn't find any resources on how to set up animations with it online, or in the docs.
Could somebody give me some pointers? ππ»
You can createAnimatedComponent
and provide animated styles, for example
import { createBox, createText } from '@shopify/restyle';
import { Animated } from 'react-native';
import type { Theme } from './theme';
export const Box = createBox<Theme>();
export const Text = createText<Theme>();
export const AnimatedBox = Animated.createAnimatedComponent(Box);
export const AnimatedText = Animated.createAnimatedComponent(Text);
Oh okay, that makes sense I guess β but how can I then transition from one variant to the next, for instance?
I assume you would need to get the primitive value from the theme object.
Thanks!