59 lines
1.5 KiB
JavaScript
59 lines
1.5 KiB
JavaScript
import { StatusBar } from "expo-status-bar";
|
|
import { Text, View, StyleSheet, ScrollView } from "react-native";
|
|
|
|
import FloatingButton from "../components/FloatingButton";
|
|
import PersonCard from '../components/PersonCard';
|
|
|
|
import { PERSONS } from '../data/PersonData';
|
|
import Colors from "../constants/colors";
|
|
|
|
const PersonOverviewScreen = (props) => {
|
|
const personSelected = (person) => {
|
|
console.log(person);
|
|
// props.navigation.navigate({
|
|
// routeName: 'Details',
|
|
// params: {
|
|
// person: person
|
|
// }
|
|
// })
|
|
}
|
|
|
|
const PersonsSorted = PERSONS.sort((a, b) => a.name.localeCompare(b.name));
|
|
|
|
const PersonsToDisplay = PersonsSorted.map( (person, index) => {
|
|
return(
|
|
<PersonCard
|
|
person={person}
|
|
onSelect={personSelected}
|
|
key={index}
|
|
/>
|
|
);
|
|
});
|
|
|
|
return (
|
|
<View style={styles.container}>
|
|
<ScrollView contentContainerStyle={styles.cardsContainer}>
|
|
{PersonsToDisplay}
|
|
</ScrollView>
|
|
<FloatingButton/>
|
|
<StatusBar style="auto" />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
export default PersonOverviewScreen;
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
backgroundColor: Colors.primary500,
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
},
|
|
cardsContainer: {
|
|
flexDirection: 'row',
|
|
flexWrap: 'wrap',
|
|
paddingBottom: 20
|
|
}
|
|
});
|