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:
@@ -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 { Text } from '@/components/Themed';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
import { FontAwesome5 } from '@expo/vector-icons';
|
import { FontAwesome5 } from '@expo/vector-icons';
|
||||||
@@ -7,18 +7,22 @@ import ServiceCard from '@/components/ServiceCard';
|
|||||||
const services = [
|
const services = [
|
||||||
{
|
{
|
||||||
key: 'sarToTmt',
|
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',
|
key: 'hotelBusinessCard',
|
||||||
icon: <FontAwesome5 name="vcard" size={24} color="#D4AF37" />,
|
title: 'Oteliň wizitkasy',
|
||||||
|
icon: <FontAwesome5 name="hotel" size={24} color="#D4AF37" />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'masterkeyBox',
|
key: 'masterkeyBox',
|
||||||
|
title: 'Oteliň açary içinde galsa',
|
||||||
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'translator',
|
key: 'translator',
|
||||||
|
title: 'Terjimeçi',
|
||||||
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -27,13 +31,13 @@ export default function ServicesScreen() {
|
|||||||
return (
|
return (
|
||||||
<SafeAreaView style={styles.container}>
|
<SafeAreaView style={styles.container}>
|
||||||
<Text style={styles.title}>{i18n.t('services')}</Text>
|
<Text style={styles.title}>{i18n.t('services')}</Text>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={services}
|
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}
|
keyExtractor={(item) => item.key}
|
||||||
numColumns={2}
|
numColumns={2}
|
||||||
columnWrapperStyle={styles.row}
|
columnWrapperStyle={styles.row}
|
||||||
/>
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -47,6 +51,7 @@ const styles = StyleSheet.create({
|
|||||||
fontSize: 22,
|
fontSize: 22,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
marginVertical: 15,
|
marginVertical: 15,
|
||||||
|
marginLeft: 15,
|
||||||
},
|
},
|
||||||
row: {
|
row: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user