updated search

This commit is contained in:
DevOFVictory
2025-10-23 18:49:01 +02:00
parent 0fbe217fce
commit 30dab9051a
6 changed files with 76 additions and 70 deletions

View File

@@ -1,5 +1,6 @@
import { FontAwesome } from "@expo/vector-icons";
import { useNavigation } from "@react-navigation/native";
import { router } from "expo-router";
import React from "react";
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
@@ -16,16 +17,32 @@ const calcAge = (birthDate?: string | null): number | null => {
return age < 0 || age > 130 ? null : age;
};
export default function PersonRow({ person }: { person: PersonLite }) {
type Props = {
person: any;
onPress?: () => void;
};
export default function PersonRow({ person, onPress }: Props) {
const navigation = useNavigation();
const age = calcAge(person.birthDate);
const id = person.personId ?? person.id;
const goToPerson = React.useCallback(
(id: number) => {
console.log("go to person", id);
router.push({
pathname: "/participant",
params: { participantId: String(id), name: person.name },
});
}, []
);
return (
<TouchableOpacity
onPress={() => {
// If your PersonDetail expects a Person object instead of an id, adapt this accordingly
// navigation.navigate("PersonDetail" as never, { personId: id } as never);
goToPerson(Number(id));
}}
style={styles.personRow}
>
@@ -34,7 +51,7 @@ export default function PersonRow({ person }: { person: PersonLite }) {
</View>
<View style={{ flex: 1 }}>
<Text style={styles.personName}>{person.name || "Unbekannt"}{age != null ? ` (${age})` : ""}</Text>
<Text style={styles.personMeta}>aus: unterschiedlichen Shows</Text>
{/* <Text style={styles.personMeta}>aus: unterschiedlichen Shows</Text> */}
</View>
<FontAwesome name="chevron-right" size={14} color="#888" />
</TouchableOpacity>