From f7ae93bd3d830530bfadf1f540584bc5175ad385 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 27 Aug 2025 22:46:20 +0800 Subject: [PATCH] feat(ui): update Pressable ripple effect for device type in HomeScreen, StyledButton, and VideoCard components --- app/index.tsx | 2 +- components/StyledButton.tsx | 4 +++- components/VideoCard.tv.tsx | 14 +++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/index.tsx b/app/index.tsx index 8e38248..b2cadb0 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -167,7 +167,7 @@ export default function HomeScreen() { 首页 - router.push("/live")}> + router.push("/live")}> {({ focused }) => ( 直播 )} diff --git a/components/StyledButton.tsx b/components/StyledButton.tsx index e87d6d7..e90beca 100644 --- a/components/StyledButton.tsx +++ b/components/StyledButton.tsx @@ -3,6 +3,7 @@ import { Animated, Pressable, StyleSheet, StyleProp, ViewStyle, PressableProps, import { ThemedText } from "./ThemedText"; import { Colors } from "@/constants/Colors"; import { useButtonAnimation } from "@/hooks/useAnimation"; +import { useResponsiveLayout } from "@/hooks/useResponsiveLayout"; interface StyledButtonProps extends PressableProps { children?: React.ReactNode; @@ -19,6 +20,7 @@ export const StyledButton = forwardRef( const colors = Colors[colorScheme]; const [isFocused, setIsFocused] = React.useState(false); const animationStyle = useButtonAnimation(isFocused); + const deviceType = useResponsiveLayout().deviceType; const variantStyles = { default: StyleSheet.create({ @@ -108,7 +110,7 @@ export const StyledButton = forwardRef( return ( setIsFocused(true)} onBlur={() => setIsFocused(false)} diff --git a/components/VideoCard.tv.tsx b/components/VideoCard.tv.tsx index 42bd878..cd32fcc 100644 --- a/components/VideoCard.tv.tsx +++ b/components/VideoCard.tv.tsx @@ -7,6 +7,7 @@ import { API } from "@/services/api"; import { ThemedText } from "@/components/ThemedText"; import { Colors } from "@/constants/Colors"; import Logger from '@/utils/Logger'; +import { useResponsiveLayout } from "@/hooks/useResponsiveLayout"; const logger = Logger.withTag('VideoCardTV'); @@ -54,6 +55,8 @@ const VideoCard = forwardRef( const scale = useRef(new Animated.Value(1)).current; + const deviceType = useResponsiveLayout().deviceType; + const animatedStyle = { transform: [{ scale }], }; @@ -148,11 +151,7 @@ const VideoCard = forwardRef( return (