Update ServicesScreen to include localized titles for service cards and improve layout with FlatList integration

- Added localized titles for each service in the services array.
- Updated FlatList to render service cards using the new title property.
- Minor style adjustment to the title margin for better alignment.
This commit is contained in:
2025-08-20 10:49:38 +05:00
parent a8ec876cc0
commit af9247fecc

View File

@@ -1,4 +1,4 @@
import { StyleSheet, SafeAreaView, FlatList } from 'react-native';
import { StyleSheet, SafeAreaView, FlatList, View } from 'react-native';
import { Text } from '@/components/Themed';
import i18n from '@/i18n';
import { FontAwesome5 } from '@expo/vector-icons';
@@ -7,18 +7,22 @@ import ServiceCard from '@/components/ServiceCard';
const services = [
{
key: 'sarToTmt',
icon: <FontAwesome5 name="exchange-alt" size={24} color="#D4AF37" />,
title: 'Manat kursy',
icon: <FontAwesome5 name="dollar-sign" size={24} color="#D4AF37" />,
},
{
key: 'hotelBusinessCard',
icon: <FontAwesome5 name="vcard" size={24} color="#D4AF37" />,
title: 'Oteliň wizitkasy',
icon: <FontAwesome5 name="hotel" size={24} color="#D4AF37" />,
},
{
key: 'masterkeyBox',
title: 'Oteliň açary içinde galsa',
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
},
{
key: 'translator',
title: 'Terjimeçi',
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
},
];
@@ -29,7 +33,7 @@ export default function ServicesScreen() {
<Text style={styles.title}>{i18n.t('services')}</Text>
<FlatList
data={services}
renderItem={({ item }) => <ServiceCard title={i18n.t(item.key)} icon={item.icon} />}
renderItem={({ item }) => <ServiceCard title={item.title} icon={item.icon} />}
keyExtractor={(item) => item.key}
numColumns={2}
columnWrapperStyle={styles.row}
@@ -47,6 +51,7 @@ const styles = StyleSheet.create({
fontSize: 22,
fontWeight: 'bold',
marginVertical: 15,
marginLeft: 15,
},
row: {
flex: 1,