Small fix to show current local on settings
This commit is contained in:
@@ -9,10 +9,11 @@ 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";
|
||||||
|
|
||||||
|
|
||||||
let MenuView = ({ navigation }) => {
|
let MenuView = ({ navigation }) => {
|
||||||
const [value, setValue] = React.useState('es');
|
const [value, setValue] = React.useState(i18n.locale);
|
||||||
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;
|
||||||
@@ -34,6 +35,8 @@ let MenuView = ({ navigation }) => {
|
|||||||
i18n.locale = locale;
|
i18n.locale = locale;
|
||||||
Moment.locale(locale);
|
Moment.locale(locale);
|
||||||
setValue(locale);
|
setValue(locale);
|
||||||
|
//Change local on profile then reload
|
||||||
|
//reloadAppAsync();
|
||||||
}
|
}
|
||||||
const profileLists = myProfiles.map((profile) => {
|
const profileLists = myProfiles.map((profile) => {
|
||||||
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
|
const DefaultPhoto = "https://social.emmint.com/uploads/e6f9be6d665dc43417701bf16a90122c.png";
|
||||||
@@ -73,19 +76,21 @@ let MenuView = ({ navigation }) => {
|
|||||||
{profileLists}
|
{profileLists}
|
||||||
</List.Accordion>
|
</List.Accordion>
|
||||||
<List.Section title="User Actions">
|
<List.Section title="User Actions">
|
||||||
<List.Item title={i18n.t('message.profile')} onPress={() => { navigation.navigate("ProfileSettings") }} left={props => <List.Icon {...props} icon="person" />} />
|
<List.Item key='ProfileEditor' title={i18n.t('message.profile')} onPress={() => { navigation.navigate("ProfileSettings") }} left={props => <List.Icon {...props} icon="person" />} />
|
||||||
<List.Item title={i18n.t('message.settings')} left={props => <List.Icon {...props} icon="settings" />} />
|
<List.Item key='Settings' title={i18n.t('message.settings')} left={props => <List.Icon {...props} icon="settings" />} />
|
||||||
<List.Item title={i18n.t('message.logout')} onPress={() => { navigation.navigate("Logout") }} left={props => <List.Icon {...props} icon="logout" />} />
|
<List.Item key="Logout" title={i18n.t('message.logout')} onPress={() => { navigation.navigate("Logout") }} left={props => <List.Icon {...props} icon="logout" />} />
|
||||||
</List.Section>
|
</List.Section>
|
||||||
<List.Section title="Fellowship App">
|
<List.Section title="Fellowship App">
|
||||||
<List.Item title={i18n.t('message.invite')} onPress={() => { navigation.navigate("Invite") }} left={props => <List.Icon {...props} icon="person-add" />} />
|
<List.Item key='Invite' title={i18n.t('message.invite')} onPress={() => { navigation.navigate("Invite") }} left={props => <List.Icon {...props} icon="person-add" />} />
|
||||||
<List.Item title={i18n.t('message.about')} left={props => <List.Icon {...props} icon="more" />} />
|
<List.Item key='About' title={i18n.t('message.about')} left={props => <List.Icon {...props} icon="more" />} />
|
||||||
</List.Section>
|
</List.Section>
|
||||||
<View style={{ padding: 10 }}>
|
<View style={{ padding: 10 }}>
|
||||||
<Text>App Language:</Text>
|
<Text>App Language:</Text>
|
||||||
<RadioButton.Group onValueChange={newValue => changeLang(newValue)} value={value}>
|
<RadioButton.Group onValueChange={newValue => changeLang(newValue)} value={value}>
|
||||||
<RadioButton.Item value="es" label="Español" />
|
<RadioButton.Item value="es" label="Español" />
|
||||||
<RadioButton.Item value="en" label="English" />
|
<RadioButton.Item value="en" label="English" />
|
||||||
|
<RadioButton.Item value="da" label="Danish" />
|
||||||
|
<RadioButton.Item value="fr" label="French" />
|
||||||
</RadioButton.Group>
|
</RadioButton.Group>
|
||||||
</View>
|
</View>
|
||||||
</ImageBackground>
|
</ImageBackground>
|
||||||
|
|||||||
@@ -300,6 +300,7 @@ const messages = {
|
|||||||
const i18n = new I18n(messages);
|
const i18n = new I18n(messages);
|
||||||
|
|
||||||
// Set the locale once at the beginning of your app.
|
// Set the locale once at the beginning of your app.
|
||||||
|
// TODO: Check user Lcale
|
||||||
i18n.locale = getLocales()[0].languageCode;
|
i18n.locale = getLocales()[0].languageCode;
|
||||||
moment.locale(i18n.locale);
|
moment.locale(i18n.locale);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user