chore: save pending Menu.js changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { View, ImageBackground, ScrollView } from "react-native";
|
import { View, ImageBackground, ScrollView } from "react-native";
|
||||||
import { Text, List, RadioButton } from "react-native-paper";
|
import { Text, List, Menu, Button } from "react-native-paper";
|
||||||
import i18n from "../i18nMessages.js";
|
import i18n from "../i18nMessages.js";
|
||||||
import Moment from 'moment';
|
import Moment from 'moment';
|
||||||
import 'moment/min/locales';
|
import 'moment/min/locales';
|
||||||
@@ -9,12 +9,12 @@ import API from '../API.js';
|
|||||||
import { useSnapshot } from 'valtio';
|
import { useSnapshot } from 'valtio';
|
||||||
import GlobalState from '../contexts/GlobalState.js';
|
import GlobalState from '../contexts/GlobalState.js';
|
||||||
import ProfileCardHorizontal from "../components/ProfileCardHorizontal.js";
|
import ProfileCardHorizontal from "../components/ProfileCardHorizontal.js";
|
||||||
import { reloadAppAsync } from "expo";
|
|
||||||
import * as Updates from 'expo-updates';
|
import * as Updates from 'expo-updates';
|
||||||
|
|
||||||
|
|
||||||
let MenuView = ({ navigation }) => {
|
let MenuView = ({ navigation }) => {
|
||||||
const [value, setValue] = React.useState(i18n.locale);
|
const [value, setValue] = React.useState(i18n.locale);
|
||||||
|
const [languageMenuVisible, setLanguageMenuVisible] = React.useState(false);
|
||||||
const [myProfiles, setMyProfiles] = React.useState([]);
|
const [myProfiles, setMyProfiles] = React.useState([]);
|
||||||
const gState = useSnapshot(GlobalState);
|
const gState = useSnapshot(GlobalState);
|
||||||
const viewer = gState.me;
|
const viewer = gState.me;
|
||||||
@@ -37,8 +37,15 @@ let MenuView = ({ navigation }) => {
|
|||||||
Moment.locale(locale);
|
Moment.locale(locale);
|
||||||
setValue(locale);
|
setValue(locale);
|
||||||
//Change local on profile then reload
|
//Change local on profile then reload
|
||||||
//reloadAppAsync();
|
|
||||||
}
|
}
|
||||||
|
const languageOptions = [
|
||||||
|
{ value: "es", label: i18n.t("message.languageSpanish") },
|
||||||
|
{ value: "en", label: i18n.t("message.languageEnglish") },
|
||||||
|
{ value: "da", label: i18n.t("message.languageDanish") },
|
||||||
|
{ value: "fr", label: i18n.t("message.languageFrench") },
|
||||||
|
];
|
||||||
|
const currentLanguageLabel = languageOptions.find((opt) => opt.value === value)?.label || i18n.t("message.languageEnglish");
|
||||||
|
|
||||||
const profileLists = myProfiles.map((profile) => {
|
const profileLists = myProfiles.map((profile) => {
|
||||||
const profileInfo = profile?.profile || {};
|
const profileInfo = profile?.profile || {};
|
||||||
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
|
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
|
||||||
@@ -88,12 +95,26 @@ let MenuView = ({ navigation }) => {
|
|||||||
</List.Section>
|
</List.Section>
|
||||||
<View style={{ padding: 10 }}>
|
<View style={{ padding: 10 }}>
|
||||||
<Text>{i18n.t("message.appLanguage")}:</Text>
|
<Text>{i18n.t("message.appLanguage")}:</Text>
|
||||||
<RadioButton.Group onValueChange={newValue => changeLang(newValue)} value={value}>
|
<Menu
|
||||||
<RadioButton.Item value="es" label={i18n.t("message.languageSpanish")} />
|
visible={languageMenuVisible}
|
||||||
<RadioButton.Item value="en" label={i18n.t("message.languageEnglish")} />
|
onDismiss={() => setLanguageMenuVisible(false)}
|
||||||
<RadioButton.Item value="da" label={i18n.t("message.languageDanish")} />
|
anchor={
|
||||||
<RadioButton.Item value="fr" label={i18n.t("message.languageFrench")} />
|
<Button mode="outlined" onPress={() => setLanguageMenuVisible(true)}>
|
||||||
</RadioButton.Group>
|
{currentLanguageLabel}
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{languageOptions.map((option) => (
|
||||||
|
<Menu.Item
|
||||||
|
key={option.value}
|
||||||
|
title={option.label}
|
||||||
|
onPress={() => {
|
||||||
|
changeLang(option.value);
|
||||||
|
setLanguageMenuVisible(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
</View>
|
</View>
|
||||||
<View style={{ padding: 10, alignContent: "center", flex: 1 }}>
|
<View style={{ padding: 10, alignContent: "center", flex: 1 }}>
|
||||||
<Text>{i18n.t("message.version")}: {Updates.runtimeVersion}</Text>
|
<Text>{i18n.t("message.version")}: {Updates.runtimeVersion}</Text>
|
||||||
|
|||||||
Reference in New Issue
Block a user