Adding logout and some i18n
This commit is contained in:
1
App.js
1
App.js
@@ -266,6 +266,7 @@ export default function App() {
|
|||||||
/>
|
/>
|
||||||
<Stack.Screen name="SinglePost" component={SinglePost} />
|
<Stack.Screen name="SinglePost" component={SinglePost} />
|
||||||
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
|
<Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
|
||||||
|
<Tab.Screen name="Logout" component={Login} />
|
||||||
</Stack.Navigator>
|
</Stack.Navigator>
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
</PaperProvider>
|
</PaperProvider>
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ export default function App({navigation, route}) {
|
|||||||
<SafeAreaView style={styles.container}>
|
<SafeAreaView style={styles.container}>
|
||||||
<LoginForm />
|
<LoginForm />
|
||||||
<StatusBar style="auto" />
|
<StatusBar style="auto" />
|
||||||
|
<View style={{position:"absolute", top:30, left: 10, opacity: 0.5}}>
|
||||||
|
<Text>{"<- Not an EMI family memeber?"}</Text>
|
||||||
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ let MenuView = ({navigation})=>{
|
|||||||
<List.Section title="User Actions">
|
<List.Section title="User Actions">
|
||||||
<List.Item title="Profile" onPress={()=>{navigation.navigate("ProfileSettings")}} left={props => <List.Icon {...props} icon="person" />} />
|
<List.Item title="Profile" onPress={()=>{navigation.navigate("ProfileSettings")}} left={props => <List.Icon {...props} icon="person" />} />
|
||||||
<List.Item title="Settings" left={props => <List.Icon {...props} icon="settings" />} />
|
<List.Item title="Settings" left={props => <List.Icon {...props} icon="settings" />} />
|
||||||
<List.Item title="Sign out" left={props => <List.Icon {...props} icon="logout" />} />
|
<List.Item title="Sign out" 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="Invite" onPress={()=>{navigation.navigate("Invite")}} left={props => <List.Icon {...props} icon="person-add" />} />
|
<List.Item title="Invite" onPress={()=>{navigation.navigate("Invite")}} left={props => <List.Icon {...props} icon="person-add" />} />
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ Moment.locale(i18n.locale);
|
|||||||
import { useSnapshot } from 'valtio';
|
import { useSnapshot } from 'valtio';
|
||||||
import GlobalState from '../contexts/GlobalState.js';
|
import GlobalState from '../contexts/GlobalState.js';
|
||||||
import API from "../API.js";
|
import API from "../API.js";
|
||||||
import ProfileHeader from "../components/ProfileHeader.js";
|
|
||||||
import * as ImagePicker from 'expo-image-picker';
|
import * as ImagePicker from 'expo-image-picker';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Text, View, StyleSheet, Image } from 'react-native';
|
import { Text, View, StyleSheet, Image } from 'react-native';
|
||||||
import { TextInput, Button } from 'react-native-paper';
|
import { TextInput, Button, HelperText } from 'react-native-paper';
|
||||||
import API from './../API.js';
|
import API from './../API.js';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import i18n from "../i18nMessages.js";
|
import i18n from "../i18nMessages.js";
|
||||||
|
|
||||||
|
|
||||||
let LoginForm = () => {
|
let LoginForm = () => {
|
||||||
let [email, setEmail] = useState('');
|
const [email, setEmail] = useState('');
|
||||||
let [password, setPassword] = useState('');
|
const [password, setPassword] = useState('');
|
||||||
|
const [error, setError] = useState('');
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
const loginCall = async ()=>{
|
const loginCall = async ()=>{
|
||||||
@@ -17,7 +18,9 @@ let LoginForm = () => {
|
|||||||
index: 0,
|
index: 0,
|
||||||
routes: [{ name: 'MainNavigation' }],
|
routes: [{ name: 'MainNavigation' }],
|
||||||
});
|
});
|
||||||
alert(i18n.t('message.wrongInformation'))
|
//console.log(r)
|
||||||
|
setError(r.status);
|
||||||
|
//alert(i18n.t('message.wrongInformation'))
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -39,6 +42,9 @@ let LoginForm = () => {
|
|||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
/>
|
/>
|
||||||
|
{error !== '' && error !== 'incorrect password' ? <HelperText type="error" visible={true}>
|
||||||
|
{i18n.t("message.invalidEmail")}
|
||||||
|
</HelperText> : <></>}
|
||||||
<TextInput
|
<TextInput
|
||||||
style={styles.input}
|
style={styles.input}
|
||||||
onChangeText={text => setPassword(text)}
|
onChangeText={text => setPassword(text)}
|
||||||
@@ -52,6 +58,9 @@ let LoginForm = () => {
|
|||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
mode="outlined"
|
mode="outlined"
|
||||||
/>
|
/>
|
||||||
|
{error === 'incorrect password' ? <HelperText type="error" visible={true}>
|
||||||
|
{i18n.t("message.reviewPassword")}
|
||||||
|
</HelperText> : <></>}
|
||||||
<Button
|
<Button
|
||||||
style={styles.button}
|
style={styles.button}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ const messages = {
|
|||||||
submit: "Submit",
|
submit: "Submit",
|
||||||
IKnowThisPerson: "I know this person",
|
IKnowThisPerson: "I know this person",
|
||||||
update: "Update",
|
update: "Update",
|
||||||
|
invalidEmail: "Email address is invalid!",
|
||||||
|
reviewPassword: "Please review your passwrod.",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
es: {
|
es: {
|
||||||
@@ -125,6 +126,8 @@ const messages = {
|
|||||||
submit: "Ingresar",
|
submit: "Ingresar",
|
||||||
IKnowThisPerson: "Conozco a esta persona",
|
IKnowThisPerson: "Conozco a esta persona",
|
||||||
update: "Actualizar",
|
update: "Actualizar",
|
||||||
|
invalidEmail: "El correo electronico es invalido!",
|
||||||
|
reviewPassword: "Revisa la constraseña introducida.",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user