feat(ui): replace TouchableOpacity with Pressable for improved ripple effect and add color customization, android focus effect

This commit is contained in:
James Chen
2025-08-27 17:22:11 +08:00
parent a53dde92eb
commit 4c93736c5e
3 changed files with 13 additions and 5 deletions

View File

@@ -108,6 +108,7 @@ export const StyledButton = forwardRef<View, StyledButtonProps>(
return (
<Animated.View style={[animationStyle, style]}>
<Pressable
android_ripple={{ color: Colors.dark.link, borderless: false }}
ref={ref}
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}

View File

@@ -1,5 +1,5 @@
import React, { useState, useEffect, useCallback, useRef, forwardRef } from "react";
import { View, Text, Image, StyleSheet, TouchableOpacity, Alert, Animated } from "react-native";
import { View, Text, Image, StyleSheet, Pressable, TouchableOpacity, Alert, Animated } from "react-native";
import { useRouter } from "expo-router";
import { Star, Play } from "lucide-react-native";
import { PlayRecordManager } from "@/services/storage";
@@ -147,13 +147,18 @@ const VideoCard = forwardRef<View, VideoCardProps>(
return (
<Animated.View style={[styles.wrapper, animatedStyle, { opacity: fadeAnim }]}>
<TouchableOpacity
<Pressable
android_ripple={{
color: Colors.dark.link,
borderless: false,
foreground: true,
}}
onPress={handlePress}
onLongPress={handleLongPress}
onFocus={handleFocus}
onBlur={handleBlur}
style={styles.pressable}
activeOpacity={1}
// activeOpacity={1}
delayLongPress={1000}
>
<View style={styles.card}>
@@ -203,7 +208,8 @@ const VideoCard = forwardRef<View, VideoCardProps>(
</View>
)}
</View>
</TouchableOpacity>
</Pressable>
</Animated.View>
);
}