"use client"; import { View } from "react-native"; import { config, LocaleLabel, useTranslation } from "@turbostarter/i18n"; import { Locale } from "@turbostarter/i18n"; import { cn } from "@turbostarter/ui"; import { Button } from "./button"; import { Icons } from "./icons"; import { Text } from "./text"; import type { Icon } from "./icons"; export const LocaleIcon: Record = { [Locale.EN]: Icons.UnitedKingdom, [Locale.ES]: Icons.Spain, } as const; interface LocaleCustomizerProps { readonly onChange?: (lang: Locale) => Promise | void; } export const LocaleCustomizer = ({ onChange }: LocaleCustomizerProps) => { const { i18n } = useTranslation("common"); const lang = i18n.language as Locale; const handleLocaleChange = async (lang: Locale) => { await onChange?.(lang); await i18n.changeLanguage(lang); }; return ( {config.locales.map((locale) => { const Icon = LocaleIcon[locale]; return ( ); })} ); };