Skip to content

Commit

Permalink
step 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Caputo committed Dec 5, 2024
1 parent ad547a5 commit dbbc74e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/[detail].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ import { IMG_HEIGHT } from "@/constants";
import { useLocalSearchParams } from "expo-router";
import { StyleSheet, View, Text } from "react-native";
import Animated, { FadeInDown } from "react-native-reanimated";
import { Image } from "expo-image";
import { AnimatedExpoImage } from "@/components/ListItem";

const DetailPage = () => {
const { detail } = useLocalSearchParams<{ detail: string }>();

return (
<View style={styles.mainContainer}>
<View style={styles.imageWrapper}>
<Image source={detail} style={styles.image} />
<AnimatedExpoImage
source={detail}
style={styles.image}
sharedTransitionTag={detail}
/>
</View>
<Animated.View style={[{ padding: 16 }]} entering={FadeInDown.delay(400)}>
<Text style={{ fontSize: 20 }}>
Expand Down
9 changes: 8 additions & 1 deletion components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ type ListItemProps = {
selectedIndex: SharedValue<number | null>;
};

export const AnimatedExpoImage = Animated.createAnimatedComponent(Image);

const ListItem = ({
source,
listYTranslation,
Expand Down Expand Up @@ -76,7 +78,12 @@ const ListItem = ({
<Animated.View style={[styles.itemWrapper, rItemStyle]}>
<GestureDetector gesture={tapGesture}>
<Animated.View style={[styles.imageWrapper, rImgStyle]}>
<Image source={source} style={styles.image} contentFit="cover" />
<AnimatedExpoImage
source={source}
style={styles.image}
contentFit="cover"
sharedTransitionTag={source}
/>
</Animated.View>
</GestureDetector>
<Link href={`/${source}`} asChild>
Expand Down

0 comments on commit dbbc74e

Please sign in to comment.