Lucide React Native Animated Icon #3159
Answered
by
AnisKehila
RainPlays09
asked this question in
Help
-
How do I animated icons using |
Beta Was this translation helpful? Give feedback.
Answered by
AnisKehila
Apr 29, 2025
Replies: 1 comment
-
You can animate Lucide icons in React Native by wrapping them with import React, { useEffect } from 'react';
import { View } from 'react-native';
import { Heart } from 'lucide-react-native';
import Animated, {
useSharedValue,
useAnimatedStyle,
withTiming,
Easing,
createAnimatedComponent,
} from 'react-native-reanimated';
const AnimatedHeart = createAnimatedComponent(Heart);
export default function AnimatedIcon() {
const rotation = useSharedValue(0);
const animatedStyle = useAnimatedStyle(() => ({
transform: [{ rotate: `${rotation.value}deg` }],
}));
useEffect(() => {
rotation.value = withTiming(360, {
duration: 1000,
easing: Easing.inOut(Easing.ease),
});
}, []);
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<AnimatedHeart size={48} color="red" style={animatedStyle} />
</View>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RainPlays09
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can animate Lucide icons in React Native by wrapping them with
createAnimatedComponent
fromreact-native-reanimated
. Here's a simple example: