| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import { Colors } from "@/constants/Colors";
- import { TabItem } from "@/services/base";
- import { Image } from "expo-image";
- import React from "react";
- import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
- // 小程序 item 宽度 162rpx = 81pt
- const ITEM_WIDTH = 81;
- interface QuickEntryProps {
- data: TabItem[];
- onPress?: (item: TabItem) => void;
- }
- export function QuickEntry({ data, onPress }: QuickEntryProps) {
- return (
- <View style={styles.container}>
- <View style={styles.center}>
- {data.map((item, index) => (
- <TouchableOpacity
- key={index}
- style={styles.item}
- activeOpacity={0.7}
- onPress={() => onPress?.(item)}
- >
- <View style={styles.itemBox}>
- <Image
- source={item.cover}
- style={styles.icon}
- contentFit="contain"
- />
- <Text style={styles.title}>{item.title}</Text>
- </View>
- </TouchableOpacity>
- ))}
- </View>
- </View>
- );
- }
- const styles = StyleSheet.create({
- container: {
- width: "100%",
- marginTop: 10,
- marginBottom: 5,
- paddingHorizontal: 10,
- },
- center: {
- width: "100%",
- flexDirection: "row",
- flexWrap: "wrap",
- justifyContent: "space-around",
- },
- item: {
- width: ITEM_WIDTH,
- alignItems: "center",
- },
- itemBox: {
- alignItems: "center",
- // Glow effect for icons
- shadowColor: Colors.neonBlue,
- shadowOffset: { width: 0, height: 0 },
- shadowOpacity: 0.3,
- shadowRadius: 5,
- },
- icon: {
- width: 48, // Reduced slightly from ITEM_WIDTH to fit better
- height: 48,
- marginBottom: 4,
- },
- title: {
- fontSize: 11,
- fontWeight: "500",
- color: Colors.textSecondary,
- textShadowColor: "rgba(0, 243, 255, 0.3)",
- textShadowOffset: { width: 0, height: 0 },
- textShadowRadius: 3,
- },
- });
|