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