Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Prateek Kumar authored and Prateek Kumar committed Mar 9, 2023
1 parent 3ffdc05 commit 3dcd6d9
Show file tree
Hide file tree
Showing 119 changed files with 23,316 additions and 103 deletions.
2 changes: 2 additions & 0 deletions .bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
165 changes: 62 additions & 103 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,104 +1,63 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
7 changes: 7 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.6
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
88 changes: 88 additions & 0 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import * as React from 'react';
import {DefaultTheme, Provider as PaperProvider} from 'react-native-paper';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {GetJsonData} from './src/asyncStorage';
import Dashboard from './src/components/Dashboard';
import LoadingScreen from './src/components/LoadingScreen';
import Login from './src/components/Login';

const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: '#0474a4',
accent: '#f1c40f',
},
};

const Stack = createNativeStackNavigator();

const getScreen = (data: userDataProp) => {
if (data?.userName && data?.mobileNo) {
return (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName="Dashboard">
<Stack.Screen name="Dashboard" component={Dashboard} />
<Stack.Screen name="Login" component={Login} />
</Stack.Navigator>
);
} else {
return (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
initialRouteName="Login">
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="Dashboard" component={Dashboard} />
</Stack.Navigator>
);
}
};

type userDataProp = {
email?: string;
mobileNo: string;
userName: string;
};

export default function App() {
const [loading, setLoading] = React.useState<boolean>(true);
const [userData, setUserData] = React.useState<userDataProp>({
email: '',
mobileNo: '',
userName: '',
});

React.useEffect(() => {
const getuserData = async () => {
const data = await GetJsonData('userDetails');
if (data) {
setTimeout(() => {
setLoading(false);
}, 1000);

setUserData(data);
} else if (!data) {
setLoading(false);
}
};
getuserData();
}, []);

if (loading) {
return <LoadingScreen />;
}
return (
<SafeAreaProvider>
<PaperProvider theme={theme}>
<NavigationContainer>{getScreen(userData)}</NavigationContainer>
</PaperProvider>
</SafeAreaProvider>
);
}
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http:https://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip

gem 'cocoapods', '~> 1.11', '>= 1.11.3'
14 changes: 14 additions & 0 deletions __tests__/App-test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/**
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
});
1 change: 1 addition & 0 deletions _node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
Loading

0 comments on commit 3dcd6d9

Please sign in to comment.