import { View, Text, StyleSheet, TouchableOpacity, SafeAreaView, StatusBar, Platform } from "react-native"; import BackIcon from "../../components/BackIcon"; import fontSize from "../../utils/fontsizeUtils"; import LeftArrowIcon from "../../components/DownArrowIcon"; import { useNavigation } from "@react-navigation/native"; import { NativeStackNavigationProp } from "@react-navigation/native-stack"; import { useState, useEffect } from "react"; import { settingApi, MySetting } from "../../services/api/setting"; import { RootStackParamList } from "../../navigation/types"; import { eventBus } from "../../utils/eventBus"; import AsyncStorage from '@react-native-async-storage/async-storage'; import { useTranslation } from "react-i18next"; export const SettingList = () => { const { t } = useTranslation(); const [mySetting, setMySetting] = useState(); const getMySetting = async () => { const res = await settingApi.getMySetting() console.log("MySetting:"); console.log(res); setMySetting(res); } useEffect(() => { getMySetting(); const refreshSetting = () => { getMySetting(); } eventBus.on("refreshSetting", refreshSetting); return () => { eventBus.off("refreshSetting", refreshSetting); }; }, []); const navigation = useNavigation>(); return ( navigation.goBack()} > {t("settings.title")} {t("settings.profile")} {t("settings.change_password")} {t("settings.change_phone")} { if (mySetting?.language && mySetting?.currency) { navigation.navigate("MyAddress"); } }} style={styles.item} > {t("settings.my_address")} {t("settings.feedback")} {t("settings.privacy_policy")} {t("settings.terms_of_use")} { AsyncStorage.clear(); navigation.navigate("CountrySelect"); }}> {t("settings.clear_cache")} { // if (mySetting?.language && mySetting?.currency) { navigation.navigate("CountrySetting", { mySetting }); // } }} style={styles.item} > {t("settings.language_currency")} ); }; const styles = StyleSheet.create({ safeArea: { flex: 1, backgroundColor: '#fff', }, safeAreaContent: { flex: 1, paddingTop: 0, backgroundColor: "#f8f8f8", }, container: { flex: 1, backgroundColor: "#f8f8f8", }, header: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", padding: 20, backgroundColor: "#fff", }, headerTitle: { fontSize: fontSize(18), fontWeight: "600", }, placeholder: { width: 24, }, content: { backgroundColor: "#fff", borderBottomWidth: 10, borderBottomColor: "#f8f8f8", }, item: { flexDirection: "row", alignItems: "center", justifyContent: "space-between", padding: 20, borderBottomWidth: 1, borderBottomColor: "#e0e0e0", }, });