Skip to content

Commit

Permalink
Formatted all JS files with Prettier (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMakesThings authored Mar 22, 2020
1 parent 7b5f6eb commit 1390f9e
Show file tree
Hide file tree
Showing 25 changed files with 1,633 additions and 1,479 deletions.
93 changes: 49 additions & 44 deletions app/Entry.js
Original file line number Diff line number Diff line change
@@ -1,96 +1,101 @@
import React, {Component } from 'react';
import React, { Component } from 'react';

import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {SafeAreaView} from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { SafeAreaView } from 'react-native';
import LocationTracking from './views/LocationTracking';
import Welcome from './views/Welcome';
import NewsScreen from './views/News';
import ExportScreen from './views/Export';
import ImportScreen from './views/Import';
import LicencesScreen from './views/Licenses';
import Slider from './views/welcomeScreens/Slider';
import {GetStoreData, SetStoreData} from './helpers/General';
import { GetStoreData, SetStoreData } from './helpers/General';

const Stack = createStackNavigator();

class Entry extends Component {
constructor(props) {
super(props);
this.state={
initialRouteName:''
}
}
constructor(props) {
super(props);
this.state = {
initialRouteName: '',
};
}

componentDidMount(){
GetStoreData('PARTICIPATE')
componentDidMount() {
GetStoreData('PARTICIPATE')
.then(isParticipating => {
console.log(isParticipating);
this.setState({
initialRouteName:isParticipating
})
console.log(isParticipating);
this.setState({
initialRouteName: isParticipating,
});
})
.catch(error => console.log(error))
}
.catch(error => console.log(error));
}

render() {
return (
<NavigationContainer>
<SafeAreaView style={{flex:1}}>
<Stack.Navigator initialRouteName='InitialScreen'>
render() {
return (
<NavigationContainer>
<SafeAreaView style={{ flex: 1 }}>
<Stack.Navigator initialRouteName="InitialScreen">
{this.state.initialRouteName === 'true' ? (
<Stack.Screen
name="InitialScreen"
component={LocationTracking}
options={{headerShown:false}}
/>
):(
name="InitialScreen"
component={LocationTracking}
options={{ headerShown: false }}
/>
) : (
<Stack.Screen
name="InitialScreen"
component={Slider}
options={{headerShown:false}}
/>
name="InitialScreen"
component={Slider}
options={{ headerShown: false }}
/>
)}
<Stack.Screen
name="Slider"
component={Slider}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="WelcomeScreen"
component={Welcome}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="LocationTrackingScreen"
component={LocationTracking}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="NewsScreen"
component={NewsScreen}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="ExportScreen"
component={ExportScreen}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="ImportScreen"
component={ImportScreen}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
<Stack.Screen
name="LicensesScreen"
component={LicencesScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="LicensesScreen"
component={LicencesScreen}
options={{headerShown:false}}
options={{ headerShown: false }}
/>
</Stack.Navigator>
</SafeAreaView>
</NavigationContainer>
)
}
</SafeAreaView>
</NavigationContainer>
);
}
}

export default Entry;
27 changes: 16 additions & 11 deletions app/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { StyleSheet, Text, TouchableOpacity } from "react-native";
import colors from "../constants/colors";
import * as React from 'react';
import { StyleSheet, Text, TouchableOpacity } from 'react-native';
import colors from '../constants/colors';

interface Props {
label: string;
Expand All @@ -12,7 +12,12 @@ class Button extends React.Component<Props> {
render() {
const { title, onPress, bgColor } = this.props;
return (
<TouchableOpacity style={[styles.container, {backgroundColor: bgColor || colors.DODGER_BLUE}]} onPress={onPress} >
<TouchableOpacity
style={[
styles.container,
{ backgroundColor: bgColor || colors.DODGER_BLUE },
]}
onPress={onPress}>
<Text style={styles.text}>{title}</Text>
</TouchableOpacity>
);
Expand All @@ -21,21 +26,21 @@ class Button extends React.Component<Props> {

const styles = StyleSheet.create({
container: {
width: "100%",
alignItems: "center",
justifyContent: "center",
width: '100%',
alignItems: 'center',
justifyContent: 'center',
paddingVertical: 12,
borderRadius: 4,
borderWidth: StyleSheet.hairlineWidth,
borderColor: "rgba(255,255,255,0.7)"
borderColor: 'rgba(255,255,255,0.7)',
},
text: {
color: colors.WHITE,
textAlign: "center",
textAlign: 'center',
height: 28,
fontSize: 20,
fontWeight: '600',
}
},
});

export default Button;
export default Button;
26 changes: 13 additions & 13 deletions app/constants/colors.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const colors = {
BLACK: "#000",
WHITE: "#FFF",
DODGER_BLUE: "#428AF8",
SILVER: "#BEBEBE",
TORCH_RED: "#F8262F",
MISCHKA: "#E5E4E6",
BLACK: '#000',
WHITE: '#FFF',
DODGER_BLUE: '#428AF8',
SILVER: '#BEBEBE',
TORCH_RED: '#F8262F',
MISCHKA: '#E5E4E6',
APP_BACKGROUND: '#FFF8ED',
PRIMARY_TEXT: "#000",
GREEN: "#32A852",
VIOLET: "#6C3794",
PRIMARY_TEXT: '#000',
GREEN: '#32A852',
VIOLET: '#6C3794',

REG_BUTTON: "#428AF8",
POS_BUTTON: "#32A852",
NEG_BUTTON: "#F8262F",
SENS_BUTTON: "#6C3794"
REG_BUTTON: '#428AF8',
POS_BUTTON: '#32A852',
NEG_BUTTON: '#F8262F',
SENS_BUTTON: '#6C3794',
};

export default colors;
44 changes: 22 additions & 22 deletions app/helpers/General.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ import _ from 'lodash';
* @param {boolean} isString
*/
export async function GetStoreData(key, isString = true) {
try {
let data = await AsyncStorage.getItem(key);
try {
let data = await AsyncStorage.getItem(key);

if (isString) {
return data;
}
if (isString) {
return data;
}

return JSON.parse(data);
} catch (error) {
console.log(error.message);
}
return false;
return JSON.parse(data);
} catch (error) {
console.log(error.message);
}
return false;
}

/**
Expand All @@ -30,16 +30,16 @@ export async function GetStoreData(key, isString = true) {
* @param {string} key
* @param {object} item
*/
export async function SetStoreData (key, item) {
try {
//we want to wait for the Promise returned by AsyncStorage.setItem()
//to be resolved to the actual value before returning the value
if (typeof item !== 'string') {
item = JSON.stringify(item);
}
export async function SetStoreData(key, item) {
try {
//we want to wait for the Promise returned by AsyncStorage.setItem()
//to be resolved to the actual value before returning the value
if (typeof item !== 'string') {
item = JSON.stringify(item);
}

return await AsyncStorage.setItem(key, item);
} catch (error) {
console.log(error.message);
}
}
return await AsyncStorage.setItem(key, item);
} catch (error) {
console.log(error.message);
}
}
Loading

0 comments on commit 1390f9e

Please sign in to comment.