diff --git a/apps/mobile/src/modules/entry/ctx.ts b/apps/mobile/src/modules/entry/ctx.ts deleted file mode 100644 index 492fb0fceb..0000000000 --- a/apps/mobile/src/modules/entry/ctx.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createContext, useContext } from "react" - -const SharedElementAnimationContext = createContext(true) -export const SharedElementAnimationContextProvider = SharedElementAnimationContext.Provider -export const useShouldAnimate = () => useContext(SharedElementAnimationContext) diff --git a/apps/mobile/src/screens/(headless)/_layout.tsx b/apps/mobile/src/screens/(headless)/_layout.tsx index 79d59a02dd..ed7a8a6b74 100644 --- a/apps/mobile/src/screens/(headless)/_layout.tsx +++ b/apps/mobile/src/screens/(headless)/_layout.tsx @@ -1,32 +1,18 @@ import { Stack } from "expo-router" -import { useState } from "react" import { useColorScheme } from "react-native" -import { SharedElementAnimationContextProvider } from "@/src/modules/entry/ctx" import { getSystemBackgroundColor } from "@/src/theme/utils" export default function HeadlessLayout() { useColorScheme() const systemBackgroundColor = getSystemBackgroundColor() - const [shouldAnimate, setShouldAnimate] = useState(true) - return ( - - { - // disable shared element animation when navigating back to the start screen - const screenToStart = "index" - if (e.target?.startsWith(screenToStart)) { - setShouldAnimate(!e.data.closing) - } - }, - }} - /> - + return ( + ) } diff --git a/apps/mobile/src/screens/(headless)/entries/[entryId]/index.tsx b/apps/mobile/src/screens/(headless)/entries/[entryId]/index.tsx index 1ab4a6a3d4..a7995828f4 100644 --- a/apps/mobile/src/screens/(headless)/entries/[entryId]/index.tsx +++ b/apps/mobile/src/screens/(headless)/entries/[entryId]/index.tsx @@ -7,10 +7,9 @@ import PagerView from "react-native-pager-view" import { ReAnimatedExpoImage } from "@/src/components/common/AnimatedComponents" import HtmlWeb from "@/src/components/ui/typography/HtmlWeb" -import { useShouldAnimate } from "@/src/modules/entry/ctx" import { useEntry } from "@/src/store/entry/hooks" -function Media({ media, shouldAnimate }: { media: any; shouldAnimate: boolean }) { +function Media({ media }: { media: any }) { const isVideo = media.type === "video" const imageUrl = isVideo ? media.preview_image_url : media.url const videoUrl = media.url @@ -44,7 +43,7 @@ function Media({ media, shouldAnimate }: { media: any; shouldAnimate: boolean }) aspectRatio: media?.height && media.width ? media.width / media.height : 9 / 16, display: isVideo ? (status?.isLoaded ? "none" : "flex") : "flex", }} - sharedTransitionTag={shouldAnimate && imageUrl ? `entry-image-${imageUrl}` : undefined} + sharedTransitionTag={imageUrl ? `entry-image-${imageUrl}` : undefined} allowDownscaling={false} /> ) : ( @@ -75,8 +74,6 @@ export default function EntryDetailPage() { }), ) - const shouldAnimate = useShouldAnimate() - const [currentPageIndex, setCurrentPageIndex] = useState(0) const [height, setHeight] = useState(0) @@ -101,7 +98,7 @@ export default function EntryDetailPage() { }} > {mediaList.map((media) => { - return + return })} )}