Skip to content

Commit

Permalink
signup page
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeepkumar authored and pradeepkumar committed Jul 6, 2023
1 parent dc08921 commit 37d8ab1
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 9 deletions.
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
4 changes: 4 additions & 0 deletions __tests__/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {it} from '@jest/globals';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

jest.mock('@react-native-async-storage/async-storage', () =>
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
);

it('renders correctly', () => {
renderer.create(<App />);
});
4 changes: 3 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
presets: ['module:metro-react-native-babel-preset',
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',],
plugins: ['react-native-reanimated/plugin'],
};
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module.exports = {
preset: 'react-native',
collectCoverageFrom: ['src/**/*.{js,jsx, tsx}'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'identity-obj-proxy',
},
};
136 changes: 135 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
"test": "jest "
},
"dependencies": {
"@babel/preset-react": "^7.22.5",
"@gorhom/bottom-sheet": "^4.4.7",
"@react-native-async-storage/async-storage": "^1.19.0",
"@react-native-community/masked-view": "^0.1.11",
Expand All @@ -34,15 +35,18 @@
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.20.0",
"@react-native/eslint-config": "^0.72.2",
"@react-native/metro-config": "^0.72.7",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^29.5.2",
"@types/metro-config": "^0.76.3",
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"eslint": "^8.19.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.5",
"prettier": "^2.4.1",
Expand Down
4 changes: 3 additions & 1 deletion src/Navigation.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {NavigationContainer} from '@react-navigation/native';
import React from 'react';
import {createStackNavigator, TransitionPresets} from '@react-navigation/stack';
import {createStackNavigator} from '@react-navigation/stack';
import {SafeAreaView} from 'react-native';
import {useAppSelector} from './store';
import Login from './pages/Auth/Login';
import Home from './pages/Home';
import SignUp from './pages/Auth/SignUp';
const Stack = createStackNavigator();

export default function Navigation() {
Expand All @@ -24,6 +25,7 @@ export default function Navigation() {
initialRouteName={'Login'}
screenOptions={{headerShown: false}}>
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="SignUp" component={SignUp} />
</Stack.Navigator>
)}
</NavigationContainer>
Expand Down
10 changes: 10 additions & 0 deletions src/pages/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {StyleSheet, View} from 'react-native';
import {Button, Text, TextInput} from 'react-native-paper';
import {useAppDispatch} from '../../store';
import {setIsloggedIn} from '../../store/slice/authSlice';
import {NavigationProp, useNavigation} from '@react-navigation/native';

export default function Login() {
const dispatch = useAppDispatch();
const navigation = useNavigation<NavigationProp<any>>();
const {
control,
handleSubmit,
Expand Down Expand Up @@ -64,6 +66,14 @@ export default function Login() {
onPress={handleSubmit(onSubmit)}>
Login
</Button>
<View style={{marginTop: 10}} />
<Text
onPress={() => {
navigation.navigate('SignUp');
}}
style={{textAlign: 'center'}}>
Don't have account? Register
</Text>
</View>
);
}
Expand Down
Loading

0 comments on commit 37d8ab1

Please sign in to comment.