diff --git a/apps/mobile/src/modules/feed-drawer/collection-panel.tsx b/apps/mobile/src/modules/feed-drawer/collection-panel.tsx index 6437c64c7..aa68d35d9 100644 --- a/apps/mobile/src/modules/feed-drawer/collection-panel.tsx +++ b/apps/mobile/src/modules/feed-drawer/collection-panel.tsx @@ -1,5 +1,7 @@ import { cn } from "@follow/utils" +import { useEffect } from "react" import { Image, ScrollView, StyleSheet, TouchableOpacity, View } from "react-native" +import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated" import { useSafeAreaInsets } from "react-native-safe-area-context" import { FallbackIcon } from "@/src/components/ui/icon/fallback-icon" @@ -17,12 +19,12 @@ export const CollectionPanel = () => { const insets = useSafeAreaInsets() return ( @@ -46,16 +48,38 @@ const styles = StyleSheet.create({ }, }) +const ActiveIndicator = ({ isActive }: { isActive: boolean }) => { + const scaleY = useSharedValue(1) + + useEffect(() => { + if (isActive) { + scaleY.value = withTiming(1, { duration: 200 }) + } else { + scaleY.value = withTiming(0, { duration: 200 }) + } + }, [isActive, scaleY]) + + const animatedStyle = useAnimatedStyle(() => { + return { + transform: [{ scaleY: scaleY.value }], + } + }) + + return ( + + ) +} + const ViewButton = ({ viewDef }: { viewDef: ViewDefinition }) => { const selectedCollection = useSelectedCollection() const isActive = selectedCollection.type === "view" && selectedCollection.viewId === viewDef.view return ( selectCollection({ type: "view", @@ -64,6 +88,7 @@ const ViewButton = ({ viewDef }: { viewDef: ViewDefinition }) => { } style={{ backgroundColor: viewDef.activeColor }} > + ) @@ -77,10 +102,7 @@ const ListButton = ({ listId }: { listId: string }) => { return ( selectCollection({ type: "list", @@ -88,11 +110,14 @@ const ListButton = ({ listId }: { listId: string }) => { }) } > - {list.image ? ( - - ) : ( - - )} + + + {list.image ? ( + + ) : ( + + )} + ) }