Fakultas Ilmu Komputer UI

Commit a40eeb5a authored by jahnsmichael's avatar jahnsmichael
Browse files

[CHORES] init new scene

parent 377ed196
......@@ -28,6 +28,7 @@ import initialCacheState, {
} from 'contexts/AppContext/cache';
import { useMainService } from 'services'
import { Box, Text, Button, Gap } from 'components';
import ForgetPasswordPage from 'scenes/ForgetPasswordPage';
const StyledApp = styled.SafeAreaView`
height: 100%;
......@@ -284,6 +285,7 @@ const App = () => {
}}>
<Stack.Screen name="splash" component={Splash} />
<Stack.Screen name="login" component={LoginPage} />
<Stack.Screen name="forget-password" component={ForgetPasswordPage} />
<Stack.Screen name="home" component={Home} />
<Stack.Screen
name="contact-investigation-form/1"
......
import 'react-native';
import axios from 'axios';
import React from 'react';
import { useMainService } from 'services';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import ReactTestRenderer from 'react-test-renderer';
import ForgetPasswordPage from '.';
const Stack = createStackNavigator();
it('renders correctly', () => {
const instance = ReactTestRenderer.create(
<NavigationContainer>
<Stack.Navigator
screenOptions={{
header: () => <></>,
}}>
<Stack.Screen name="forget-password" component={ForgetPasswordPage} />
</Stack.Navigator>
</NavigationContainer>,
);
expect(instance.toJSON()).toMatchSnapshot();
});
\ No newline at end of file
import { useNavigation } from "@react-navigation/native";
import { Box, Text } from "components";
import React from "react";
const ForgetPasswordPage = () => {
const navigation = useNavigation();
return (
<Box
axis={Box.Axis.Vertical}
height="100%"
width="100%"
background="transparent"
>
<Text isBold={true} fontSize='48px'>Lupa Password Page</Text>
</Box>
)
}
export default ForgetPasswordPage;
\ No newline at end of file
import React, {useContext, useState} from 'react';
import {AppContext} from 'contexts';
import React, { useContext, useState } from 'react';
import { AppContext } from 'contexts';
import styled from 'styled-components/native';
import {Image} from 'react-native';
import { Image } from 'react-native';
import {Box, Button, Text, Field, Cloud, Gap} from 'components';
import {useFormState} from 'helpers';
import {LocalStorage} from 'services';
import {useNavigation} from '@react-navigation/native';
import { Box, Button, Text, Field, Cloud, Gap } from 'components';
import { useFormState } from 'helpers';
import { LocalStorage } from 'services';
import { useNavigation } from '@react-navigation/native';
import WaveBackground from 'assets/arts/background-wave.png';
import WonderingIllustration from 'assets/illustrations/wondering.png';
......@@ -20,7 +20,7 @@ enum LoginResponse {
const LoginPage = () => {
const navigation = useNavigation();
const [isFirstTime, setIsFirstTime] = useState(true);
const {setToken, services, setAlert, shouldLoading, setShouldLoading} = useContext(AppContext);
const { setToken, services, setAlert, shouldLoading, setShouldLoading } = useContext(AppContext);
const [form, setField] = useFormState({
username: {
type: 'text',
......@@ -96,15 +96,15 @@ const LoginPage = () => {
setIsFirstTime(false);
}
if (form.isValid) {
setShouldLoading(true)
const loginRes = await services.main.login({
username: form.fields.username.value,
password: form.fields.password.value,
});
setShouldLoading(false)
if (loginRes === undefined) {
......@@ -133,6 +133,16 @@ const LoginPage = () => {
Masuk
</Button>
</Box>
<Gap axis={Gap.Axis.Vertical} gap={14}></Gap>
<Box>
<Button
id="forgetpass"
clickable={!shouldLoading}
type={Button.Type.Outline}
onPress={() => navigation.navigate('forget-password')}>
Lupa Password
</Button>
</Box>
<Line />
<Box>
<Button
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment