From 9bcdeaa44d3b1ea28f31f41d0ff54c9307733013 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 27 Aug 2025 18:07:22 +0800 Subject: [PATCH] feat(platform): customize android ripple effect for Pressable based on platform type --- app/index.tsx | 4 ++-- components/StyledButton.tsx | 4 ++-- components/VideoCard.tv.tsx | 28 +++++++++++++++------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/index.tsx b/app/index.tsx index ed1fe18..8e38248 100644 --- a/app/index.tsx +++ b/app/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useCallback, useRef, useState } from "react"; -import { View, StyleSheet, ActivityIndicator, FlatList, Pressable, Animated, StatusBar } from "react-native"; +import { View, StyleSheet, ActivityIndicator, FlatList, Pressable, Animated, StatusBar, Platform } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { ThemedView } from "@/components/ThemedView"; import { ThemedText } from "@/components/ThemedText"; @@ -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 d0d582c..e87d6d7 100644 --- a/components/StyledButton.tsx +++ b/components/StyledButton.tsx @@ -1,5 +1,5 @@ import React, { forwardRef } from "react"; -import { Animated, Pressable, StyleSheet, StyleProp, ViewStyle, PressableProps, TextStyle, View } from "react-native"; +import { Animated, Pressable, StyleSheet, StyleProp, ViewStyle, PressableProps, TextStyle, View, Platform } from "react-native"; import { ThemedText } from "./ThemedText"; import { Colors } from "@/constants/Colors"; import { useButtonAnimation } from "@/hooks/useAnimation"; @@ -108,7 +108,7 @@ export const StyledButton = forwardRef( return ( setIsFocused(true)} onBlur={() => setIsFocused(false)} diff --git a/components/VideoCard.tv.tsx b/components/VideoCard.tv.tsx index 51c9bd8..42bd878 100644 --- a/components/VideoCard.tv.tsx +++ b/components/VideoCard.tv.tsx @@ -1,5 +1,5 @@ import React, { useState, useEffect, useCallback, useRef, forwardRef } from "react"; -import { View, Text, Image, StyleSheet, Pressable, TouchableOpacity, Alert, Animated } from "react-native"; +import { View, Text, Image, StyleSheet, Pressable, TouchableOpacity, Alert, Animated, Platform } from "react-native"; import { useRouter } from "expo-router"; import { Star, Play } from "lucide-react-native"; import { PlayRecordManager } from "@/services/storage"; @@ -148,7 +148,7 @@ const VideoCard = forwardRef( return ( ( delayLongPress={1000} > - - {isFocused && ( - - {isContinueWatching && ( - - - 继续观看 - - )} - - )} + + + {isFocused && ( + + {isContinueWatching && ( + + + 继续观看 + + )} + + )} {/* 进度条 */} {isContinueWatching && ( @@ -197,6 +198,7 @@ const VideoCard = forwardRef( {sourceName} )} + {title}