Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions EXPO/.expo/packager-info.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"devToolsPort": 19002,
"expoServerPort": 19000,
"packagerPort": 19001,
"packagerPid": 71365,
"expoServerNgrokUrl": "https://qq-bic.webo.expo.exp.direct",
"packagerNgrokUrl": "https://packager.qq-bic.webo.expo.exp.direct",
"ngrokPid": 71379
"expoServerPort": null,
"packagerPort": null,
"packagerPid": null,
"expoServerNgrokUrl": null,
"packagerNgrokUrl": null,
"ngrokPid": null
}
15 changes: 15 additions & 0 deletions EXPO/package-lock.json

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

2 changes: 2 additions & 0 deletions EXPO/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"dependencies": {
"@expo/samples": "2.1.1",
"expo": "^32.0.0",
"expo-sqlite": "^6.0.0",
"expo-sqlite-orm": "^1.5.1",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
"react-navigation": "^3.0.9"
Expand Down
124 changes: 72 additions & 52 deletions EXPO/screens/HomeScreen.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import React from 'react';
import React from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file extension should be jsx for all components

import {
Image,
Platform,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
} from 'react-native';
import { WebBrowser } from 'expo';
View
} from "react-native";
import { WebBrowser } from "expo";

import { MonoText } from '../components/StyledText';
import { MonoText } from "../components/StyledText";
import NetworkManager from "../src/network/network-manager";

export default class HomeScreen extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

functional component

static navigationOptions = {
header: null,
header: null
};

render() {
return (
<View style={styles.container}>
<ScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
<ScrollView
style={styles.container}
contentContainerStyle={styles.contentContainer}
>
<View style={styles.welcomeContainer}>
<Image
source={
__DEV__
? require('../assets/images/robot-dev.png')
: require('../assets/images/robot-prod.png')
? require("../assets/images/robot-dev.png")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extract this outside component as this will hit performance of component on update

: require("../assets/images/robot-prod.png")
}
style={styles.welcomeImage}
/>
Expand All @@ -37,8 +40,12 @@ export default class HomeScreen extends React.Component {

<Text style={styles.getStartedText}>Get started by opening</Text>

<View style={[styles.codeHighlightContainer, styles.homeScreenFilename]}>
<MonoText style={styles.codeHighlightText}>screens/HomeScreen.js</MonoText>
<View
style={[styles.codeHighlightContainer, styles.homeScreenFilename]}
>
<MonoText style={styles.codeHighlightText}>
screens/HomeScreen.js
</MonoText>
</View>

<Text style={styles.getStartedText}>
Expand All @@ -47,17 +54,28 @@ export default class HomeScreen extends React.Component {
</View>

<View style={styles.helpContainer}>
<TouchableOpacity onPress={this._handleHelpPress} style={styles.helpLink}>
<Text style={styles.helpLinkText}>Help, it didn’t automatically reload!</Text>
<TouchableOpacity
onPress={this._handleHelpPress}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove _

style={styles.helpLink}
>
<Text style={styles.helpLinkText}>
Help, it didn’t automatically reload!
</Text>
</TouchableOpacity>
</View>
</ScrollView>

<View style={styles.tabBarInfoContainer}>
<Text style={styles.tabBarInfoText}>This is a tab bar. You can edit it in:</Text>
<Text style={styles.tabBarInfoText}>
This is a tab bar. You can edit it in:
</Text>

<View style={[styles.codeHighlightContainer, styles.navigationFilename]}>
<MonoText style={styles.codeHighlightText}>navigation/MainTabNavigator.js</MonoText>
<View
style={[styles.codeHighlightContainer, styles.navigationFilename]}
>
<MonoText style={styles.codeHighlightText}>
navigation/MainTabNavigator.js
</MonoText>
</View>
</View>
</View>
Expand All @@ -74,8 +92,8 @@ export default class HomeScreen extends React.Component {

return (
<Text style={styles.developmentModeText}>
Development mode is enabled, your app will be slower but you can use useful development
tools. {learnMoreButton}
Development mode is enabled, your app will be slower but you can use
useful development tools. {learnMoreButton}
</Text>
);
} else {
Expand All @@ -88,101 +106,103 @@ export default class HomeScreen extends React.Component {
}

_handleLearnMorePress = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove _ from all methods naming, it's not as per naming conventions

WebBrowser.openBrowserAsync('https://docs.expo.io/versions/latest/guides/development-mode');
WebBrowser.openBrowserAsync(
"https://docs.expo.io/versions/latest/guides/development-mode"
);
};

_handleHelpPress = () => {
WebBrowser.openBrowserAsync(
'https://docs.expo.io/versions/latest/guides/up-and-running.html#can-t-see-your-changes'
"https://docs.expo.io/versions/latest/guides/up-and-running.html#can-t-see-your-changes"
);
};
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
backgroundColor: "#fff"
},
developmentModeText: {
marginBottom: 20,
color: 'rgba(0,0,0,0.4)',
color: "rgba(0,0,0,0.4)",
fontSize: 14,
lineHeight: 19,
textAlign: 'center',
textAlign: "center"
},
contentContainer: {
paddingTop: 30,
paddingTop: 30
},
welcomeContainer: {
alignItems: 'center',
alignItems: "center",
marginTop: 10,
marginBottom: 20,
marginBottom: 20
},
welcomeImage: {
width: 100,
height: 80,
resizeMode: 'contain',
resizeMode: "contain",
marginTop: 3,
marginLeft: -10,
marginLeft: -10
},
getStartedContainer: {
alignItems: 'center',
marginHorizontal: 50,
alignItems: "center",
marginHorizontal: 50
},
homeScreenFilename: {
marginVertical: 7,
marginVertical: 7
},
codeHighlightText: {
color: 'rgba(96,100,109, 0.8)',
color: "rgba(96,100,109, 0.8)"
},
codeHighlightContainer: {
backgroundColor: 'rgba(0,0,0,0.05)',
backgroundColor: "rgba(0,0,0,0.05)",
borderRadius: 3,
paddingHorizontal: 4,
paddingHorizontal: 4
},
getStartedText: {
fontSize: 17,
color: 'rgba(96,100,109, 1)',
color: "rgba(96,100,109, 1)",
lineHeight: 24,
textAlign: 'center',
textAlign: "center"
},
tabBarInfoContainer: {
position: 'absolute',
position: "absolute",
bottom: 0,
left: 0,
right: 0,
...Platform.select({
ios: {
shadowColor: 'black',
shadowColor: "black",
shadowOffset: { height: -3 },
shadowOpacity: 0.1,
shadowRadius: 3,
shadowRadius: 3
},
android: {
elevation: 20,
},
elevation: 20
}
}),
alignItems: 'center',
backgroundColor: '#fbfbfb',
paddingVertical: 20,
alignItems: "center",
backgroundColor: "#fbfbfb",
paddingVertical: 20
},
tabBarInfoText: {
fontSize: 17,
color: 'rgba(96,100,109, 1)',
textAlign: 'center',
color: "rgba(96,100,109, 1)",
textAlign: "center"
},
navigationFilename: {
marginTop: 5,
marginTop: 5
},
helpContainer: {
marginTop: 15,
alignItems: 'center',
alignItems: "center"
},
helpLink: {
paddingVertical: 15,
paddingVertical: 15
},
helpLinkText: {
fontSize: 14,
color: '#2e78b7',
},
color: "#2e78b7"
}
});
32 changes: 32 additions & 0 deletions EXPO/src/local-database/database-manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { SQLite } from "expo-sqlite";
import { BaseModel, types } from "expo-sqlite-orm";
import { DB_CONSTANTS } from "../utils/string-constant";

export default class DatabaseManager extends BaseModel {
constructor(obj) {
super(obj);
}

static get database() {
return async () => SQLite.openDatabase(DB_CONSTANTS.DB_NAME);
}

static get tableName() {
return DB_CONSTANTS.TABLE_NAME;
}

static get columnMapping() {
return {
id: { type: types.INTEGER, primary_key: true },
title: { type: types.TEXT, not_null: true },
description: { type: types.TEXT },
timestamp: { type: types.INTEGER, default: () => Date.now() }
};
}

static fetchRecords(query) {
return query(options);
}
}

//Reference - https://www.npmjs.com/package/expo-sqlite-orm/v/1.4.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

6 changes: 6 additions & 0 deletions EXPO/src/network/api-constant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const APIConst = {
BaseURL: "https://google.com",
URNConst: {
ShorURN: "/test"
}
};
5 changes: 5 additions & 0 deletions EXPO/src/network/api-header-constant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const Headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no newline end of file

21 changes: 21 additions & 0 deletions EXPO/src/network/network-manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Headers } from "./api-header-constant";

export default class NetworkManager {
static requestGET(url) {
return fetch(url);
}

static requestPOST(url, body, headers = Headers) {
return fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(body)
});
}

static requestHEAD(url) {
return fetch(url, {
method: "HEAD"
});
}
}
11 changes: 11 additions & 0 deletions EXPO/src/utils/colors-constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const COLORS = {
tintColor: "#fff",
backgroundColor: "rgba(255,255,255,0.8)",
progressColor: "rgba(0, 100, 251,0.8)",
tabDefaultColor: "#969292",
topNavigationColor: "black",
grayColor: "rgba(148,148,148,0.8)",
blueColor: "rgba(0, 100, 251,0.8)"
};

export default COLORS;
9 changes: 9 additions & 0 deletions EXPO/src/utils/string-constant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const STRING_CONSTANTS = {
OK_MSG: "Ok",
IOS: "ios"
};

export const DB_CONSTANTS = {
DB_NAME: "DatabaseName.db",
TABLE_NAME: "TableName"
};
Loading