Refactor ServicesScreen to enhance modal management and localization
- Updated modal state management by introducing separate states for each service modal. - Changed service titles to localized versions in Turkmen. - Improved CurrencyConverterModal integration by updating visibility state and placeholder text color for better user experience.
This commit is contained in:
@@ -7,25 +7,35 @@ import React, { useState } from 'react';
|
|||||||
import CurrencyConverterModal from '@/components/CurrencyConverterModal';
|
import CurrencyConverterModal from '@/components/CurrencyConverterModal';
|
||||||
|
|
||||||
export default function ServicesScreen() {
|
export default function ServicesScreen() {
|
||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [currencyModalVisible, setCurrencyModalVisible] = useState(false);
|
||||||
|
const [hotelModalVisible, setHotelModalVisible] = useState(false);
|
||||||
|
const [lostKeyModalVisible, setLostKeyModalVisible] = useState(false);
|
||||||
|
const [translatorModalVisible, setTranslatorModalVisible] = useState(false);
|
||||||
|
|
||||||
const services = [
|
const services = [
|
||||||
{
|
{
|
||||||
title: 'currencyConverter',
|
title: 'Pul',
|
||||||
|
name: 'currencyConverter',
|
||||||
icon: <FontAwesome5 name="dollar-sign" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="dollar-sign" size={24} color="#D4AF37" />,
|
||||||
onPress: () => setModalVisible(true),
|
onPress: () => setCurrencyModalVisible(true),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'hotelCard',
|
title: 'Otel',
|
||||||
|
name: 'hotelCard',
|
||||||
icon: <FontAwesome5 name="hotel" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="hotel" size={24} color="#D4AF37" />,
|
||||||
|
onPress: () => setHotelModalVisible(true),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'lostKey',
|
title: 'Açar içinde galdy',
|
||||||
|
name: 'lostKey',
|
||||||
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="key" size={24} color="#D4AF37" />,
|
||||||
|
onPress: () => setLostKeyModalVisible(true),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'translator',
|
title: 'Perewod',
|
||||||
|
name: 'translator',
|
||||||
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
|
icon: <FontAwesome5 name="language" size={24} color="#D4AF37" />,
|
||||||
|
onPress: () => setTranslatorModalVisible(true),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -36,13 +46,13 @@ export default function ServicesScreen() {
|
|||||||
<View style={styles.grid}>
|
<View style={styles.grid}>
|
||||||
{services.map((service, index) => (
|
{services.map((service, index) => (
|
||||||
<TouchableOpacity key={index} style={styles.cardContainer} onPress={service.onPress}>
|
<TouchableOpacity key={index} style={styles.cardContainer} onPress={service.onPress}>
|
||||||
<ServiceCard title={i18n.t(service.title)} icon={service.icon} />
|
<ServiceCard title={service.title} icon={service.icon} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
<CurrencyConverterModal
|
<CurrencyConverterModal
|
||||||
visible={modalVisible}
|
visible={currencyModalVisible}
|
||||||
onClose={() => setModalVisible(false)}
|
onClose={() => setCurrencyModalVisible(false)}
|
||||||
/>
|
/>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ const CurrencyConverterModal: React.FC<CurrencyConverterModalProps> = ({ visible
|
|||||||
style={styles.input}
|
style={styles.input}
|
||||||
keyboardType="numeric"
|
keyboardType="numeric"
|
||||||
placeholder="0.00"
|
placeholder="0.00"
|
||||||
|
placeholderTextColor="#666"
|
||||||
value={sar}
|
value={sar}
|
||||||
onChangeText={handleSarChange}
|
onChangeText={handleSarChange}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user