Replies: 2 comments
-
|
Hey @ozgentl! Have you tried using Reanimated's CSS animations API? import { useState } from 'react';
import { Button, View } from 'react-native';
import Animated, { css } from 'react-native-reanimated';
type Props = {
showDots: boolean;
};
const AnimatedDots = ({ showDots }: Props) => {
if (!showDots) return null;
return (
<View style={styles.dots}>
{[0, 1, 2].map((i) => (
<Animated.View
key={i}
style={[
styles.dot,
{
animationDelay: `${-i * 180}ms`,
},
]}
/>
))}
</View>
);
};
export default function EmptyExample() {
const [showDots, setShowDots] = useState(false);
return (
<>
<Button
title={showDots ? 'Hide Dots' : 'Show Dots'}
onPress={() => setShowDots(!showDots)}
/>
<AnimatedDots showDots={showDots} />
</>
);
}
const styles = css.create({
dots: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
gap: 10,
},
dot: {
width: 12,
height: 12,
borderRadius: '50%',
backgroundColor: 'red',
opacity: 0,
animationDuration: '1.1s',
animationTimingFunction: 'ease-in-out',
animationIterationCount: 'infinite',
animationName: {
'0%, 80%, 100%': { opacity: 0.25 },
'40%': { opacity: 1 },
},
},
});Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-04-29.at.13.17.45.mov |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@MatiPl01 thanks for reaching out so fast, no haven't used them yet because we are on a pretty old RN version (76) with reanimated v3. But thanks for pointing out, indeed looks much better. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
WIth current API it is too hard to make such animations (animating 3 dots ...):
While with RN API it looks trivial (but works terrible).
Beta Was this translation helpful? Give feedback.
All reactions