few cosmetic fixes

This commit is contained in:
2025-05-24 09:00:48 +02:00
parent 443d4b0366
commit 7873321be0
6 changed files with 194 additions and 125 deletions

View File

@@ -90,6 +90,7 @@ export default function FormScreen() {
const result = await launchCameraAsync({
allowsEditing: false,
base64: true,
quality: 0.2,
});
if (!result.canceled && result.assets && result.assets.length > 0) {

View File

@@ -1,52 +1,61 @@
import {
View,
StyleSheet,
FlatList,
View,
StyleSheet,
FlatList,
} from "react-native";
import { useTheme, Card, Text, Button } from "react-native-paper";
import { Link } from "expo-router";
import {useTheme, Card, Text, Button, ActivityIndicator} from "react-native-paper";
import {Link} from "expo-router";
import useLocationStore from "@/locationStore";
export default function Index() {
const theme = useTheme();
const { locations } = useLocationStore();
const theme = useTheme();
const {locations} = useLocationStore();
const loading = useLocationStore((state) => state.loading);
return (
<View
style={[styles.container, { backgroundColor: theme.colors.background }]}
>
<FlatList
data={locations}
keyExtractor={(item) => item.id.toString()}
renderItem={({ item }) => (
<Card style={{ margin: 10 }}>
<Card.Cover
style={{ marginBottom: 10 }}
source={item.imageSource}
/>
<Card.Content style={{ marginBottom: 10 }}>
<Text variant="titleLarge">{item.name}</Text>
<Text variant="bodyMedium">
{item.description && item.description.split(".")[0]}...
</Text>
</Card.Content>
<Card.Actions>
<Link href={`/location/${item.id}`} asChild>
<Button>Zobacz więcej</Button>
</Link>
</Card.Actions>
</Card>
)}
/>
</View>
);
if (loading) {
return (
<View style={[styles.container, {backgroundColor: theme.colors.background}]}>
<ActivityIndicator size="large" color={theme.colors.primary}/>
</View>
);
}
return (
<View
style={[styles.container, {backgroundColor: theme.colors.background}]}
>
<FlatList
data={locations}
keyExtractor={(item) => item.id.toString()}
renderItem={({item}) => (
<Card style={{margin: 10}}>
<Card.Cover
style={{marginBottom: 10}}
source={item.imageSource}
/>
<Card.Content style={{marginBottom: 10}}>
<Text variant="titleLarge">{item.name}</Text>
<Text variant="bodyMedium">
{item.description && item.description.split(".")[0]}...
</Text>
</Card.Content>
<Card.Actions>
<Link href={`/location/${item.id}`} asChild>
<Button>Zobacz więcej</Button>
</Link>
</Card.Actions>
</Card>
)}
/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#25292e",
justifyContent: "center",
alignItems: "center",
},
container: {
flex: 1,
backgroundColor: "#25292e",
justifyContent: "center",
alignItems: "center",
},
});