import React from "react"; import { View, ImageBackground, ScrollView } from "react-native"; import { Text, List, RadioButton } from "react-native-paper"; import i18n from "../i18nMessages.js"; import Moment from 'moment'; import 'moment/min/locales'; Moment.locale(i18n.locale); import API from '../API.js'; import { useSnapshot } from 'valtio'; import GlobalState from '../contexts/GlobalState.js'; import ProfileCardHorizontal from "../components/ProfileCardHorizontal.js"; let MenuView = ({ navigation }) => { const [value, setValue] = React.useState('es'); const [myProfiles, setMyProfiles] = React.useState([]); const gState = useSnapshot(GlobalState); const viewer = gState.me; React.useEffect(() => { let subscribed = true; let getData = async () => { const r = await API.getMyProfiles(); if (!subscribed) return; console.log("profiles", r) setMyProfiles(r); } getData(); return () => { subscribed = false; } }, []); let changeLang = (locale) => { i18n.locale = locale; Moment.locale(locale); setValue(locale); } return ( { navigation.navigate("ProfileSettings") }} left={props => } /> } /> { navigation.navigate("Logout") }} left={props => } /> { navigation.navigate("Invite") }} left={props => } /> } /> {i18n.t("message.language")}: changeLang(newValue)} value={value}> ) } export default MenuView;