fix(mobile): grid footer unread status updating

This commit is contained in:
DIYgod 2025-02-26 22:17:12 +08:00
parent 0a1a469d19
commit f56ede452c
No known key found for this signature in database
1 changed files with 13 additions and 1 deletions

View File

@ -1,9 +1,11 @@
import { cn } from "@follow/utils"
import { useEffect } from "react"
import { Text, View } from "react-native"
import ReAnimated, { useAnimatedStyle, useSharedValue } from "react-native-reanimated"
import ReAnimated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated"
import { RelativeDateTime } from "@/src/components/ui/datetime/RelativeDateTime"
import { FeedIcon } from "@/src/components/ui/icon/feed-icon"
import { gentleSpringPreset } from "@/src/constants/spring"
import { useEntry } from "@/src/store/entry/hooks"
import { useFeed } from "@/src/store/feed/hooks"
@ -19,6 +21,16 @@ export const EntryGridFooter = ({
const unreadZoomSharedValue = useSharedValue(entry?.read ? 0 : 1)
useEffect(() => {
if (!entry) return
if (entry.read) {
unreadZoomSharedValue.value = withSpring(0, gentleSpringPreset)
} else {
unreadZoomSharedValue.value = withSpring(1, gentleSpringPreset)
}
}, [entry, entry?.read, unreadZoomSharedValue])
const unreadIndicatorStyle = useAnimatedStyle(() => {
return {
width: unreadZoomSharedValue.value * 8,