fix(mobile): grid footer unread status updating
This commit is contained in:
parent
0a1a469d19
commit
f56ede452c
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue