mirror of
https://github.com/zimplexing/OrionTV.git
synced 2026-05-14 03:37:29 +08:00
feat(ui): replace TouchableOpacity with Pressable for improved ripple effect and add color customization, android focus effect
This commit is contained in:
@@ -15,6 +15,7 @@ import { useResponsiveLayout } from "@/hooks/useResponsiveLayout";
|
|||||||
import { getCommonResponsiveStyles } from "@/utils/ResponsiveStyles";
|
import { getCommonResponsiveStyles } from "@/utils/ResponsiveStyles";
|
||||||
import ResponsiveNavigation from "@/components/navigation/ResponsiveNavigation";
|
import ResponsiveNavigation from "@/components/navigation/ResponsiveNavigation";
|
||||||
import { useApiConfig, getApiConfigErrorMessage } from "@/hooks/useApiConfig";
|
import { useApiConfig, getApiConfigErrorMessage } from "@/hooks/useApiConfig";
|
||||||
|
import { Colors } from "@/constants/Colors";
|
||||||
|
|
||||||
const LOAD_MORE_THRESHOLD = 200;
|
const LOAD_MORE_THRESHOLD = 200;
|
||||||
|
|
||||||
@@ -166,7 +167,7 @@ export default function HomeScreen() {
|
|||||||
<View style={dynamicStyles.headerContainer}>
|
<View style={dynamicStyles.headerContainer}>
|
||||||
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
||||||
<ThemedText style={dynamicStyles.headerTitle}>首页</ThemedText>
|
<ThemedText style={dynamicStyles.headerTitle}>首页</ThemedText>
|
||||||
<Pressable style={{ marginLeft: 20 }} onPress={() => router.push("/live")}>
|
<Pressable android_ripple={{color: Colors.dark.link}} style={{ marginLeft: 20 }} onPress={() => router.push("/live")}>
|
||||||
{({ focused }) => (
|
{({ focused }) => (
|
||||||
<ThemedText style={[dynamicStyles.headerTitle, { color: focused ? "white" : "grey" }]}>直播</ThemedText>
|
<ThemedText style={[dynamicStyles.headerTitle, { color: focused ? "white" : "grey" }]}>直播</ThemedText>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -108,6 +108,7 @@ export const StyledButton = forwardRef<View, StyledButtonProps>(
|
|||||||
return (
|
return (
|
||||||
<Animated.View style={[animationStyle, style]}>
|
<Animated.View style={[animationStyle, style]}>
|
||||||
<Pressable
|
<Pressable
|
||||||
|
android_ripple={{ color: Colors.dark.link, borderless: false }}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
onFocus={() => setIsFocused(true)}
|
onFocus={() => setIsFocused(true)}
|
||||||
onBlur={() => setIsFocused(false)}
|
onBlur={() => setIsFocused(false)}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect, useCallback, useRef, forwardRef } from "react";
|
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 { useRouter } from "expo-router";
|
||||||
import { Star, Play } from "lucide-react-native";
|
import { Star, Play } from "lucide-react-native";
|
||||||
import { PlayRecordManager } from "@/services/storage";
|
import { PlayRecordManager } from "@/services/storage";
|
||||||
@@ -147,13 +147,18 @@ const VideoCard = forwardRef<View, VideoCardProps>(
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View style={[styles.wrapper, animatedStyle, { opacity: fadeAnim }]}>
|
<Animated.View style={[styles.wrapper, animatedStyle, { opacity: fadeAnim }]}>
|
||||||
<TouchableOpacity
|
<Pressable
|
||||||
|
android_ripple={{
|
||||||
|
color: Colors.dark.link,
|
||||||
|
borderless: false,
|
||||||
|
foreground: true,
|
||||||
|
}}
|
||||||
onPress={handlePress}
|
onPress={handlePress}
|
||||||
onLongPress={handleLongPress}
|
onLongPress={handleLongPress}
|
||||||
onFocus={handleFocus}
|
onFocus={handleFocus}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
style={styles.pressable}
|
style={styles.pressable}
|
||||||
activeOpacity={1}
|
// activeOpacity={1}
|
||||||
delayLongPress={1000}
|
delayLongPress={1000}
|
||||||
>
|
>
|
||||||
<View style={styles.card}>
|
<View style={styles.card}>
|
||||||
@@ -203,7 +208,8 @@ const VideoCard = forwardRef<View, VideoCardProps>(
|
|||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</Pressable>
|
||||||
|
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user