Skip to content

Instantly share code, notes, and snippets.

@IslamRustamov
Last active June 10, 2023 19:09
Show Gist options
  • Save IslamRustamov/48186588a4e6d627ec8bc219b8400c9d to your computer and use it in GitHub Desktop.
Save IslamRustamov/48186588a4e6d627ec8bc219b8400c9d to your computer and use it in GitHub Desktop.
interface Article {
title: string;
date: string;
}
// ...
interface ArticleBlockProps extends Article {
isCenter: boolean;
}
function ArticleBlock({title, date, isCenter}: ArticleBlockProps) {
const animatedStyle = useAnimatedStyle(() => {
return {
width: withSpring(isCenter ? 250 : 200),
height: withSpring(isCenter ? 110 : 60),
backgroundColor: 'beige',
borderRadius: 20,
alignItems: 'center',
justifyContent: 'center',
};
}, [isCenter]);
return (
<Animated.View style={animatedStyle}>
<Text>{title}</Text>
<Text>{date}</Text>
</Animated.View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment