-
Notifications
You must be signed in to change notification settings - Fork 0
Comp 1 #3
base: master
Are you sure you want to change the base?
Comp 1 #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,35 @@ | ||
| import React from 'react'; | ||
| import React from "react"; | ||
| 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 { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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} | ||
| /> | ||
|
|
@@ -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}> | ||
|
|
@@ -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} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
|
@@ -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 { | ||
|
|
@@ -88,101 +106,103 @@ export default class HomeScreen extends React.Component { | |
| } | ||
|
|
||
| _handleLearnMorePress = () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove |
||
| 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" | ||
| } | ||
| }); | ||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| export const APIConst = { | ||
| BaseURL: "https://google.com", | ||
| URNConst: { | ||
| ShorURN: "/test" | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export const Headers = { | ||
| Accept: 'application/json', | ||
| 'Content-Type': 'application/json', | ||
| }; | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no newline end of file |
||
| 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" | ||
| }); | ||
| } | ||
| } |
| 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; |
| 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" | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file extension should be
jsxfor all components