How to create a dynamic array of animated styles for an array of components #2037
Answered
by
mohsinulhaq
mohsinulhaq
asked this question in
Q&A
-
const AnimatedText = Animated.createAnimatedComponent(Text);
const Component = ({texts}) => {
// can't create an array of shared value for each text
const textScaleShared = useSharedValue(1);
// can't create an array of animated style for each text
const animatedTextStyle = useAnimatedStyle(() => ({
transform: [{ scale: textScaleShared.value }],
}));
useEffect(() => {
// code to reduce text scale one after another
}, [])
return texts.map(text => <AnimatedText style={animatedTextStyle}>{text}</AnimatedText>)
} I want to apply animated styles to an array of components, but since How can I achieve the same? |
Beta Was this translation helpful? Give feedback.
Answered by
mohsinulhaq
May 19, 2021
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mohsinulhaq
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/a/67590367/3734818