-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.js
More file actions
136 lines (125 loc) · 3.2 KB
/
App.js
File metadata and controls
136 lines (125 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
import React, { Component } from 'react';
import { StyleSheet, View, TouchableHighlight, Text } from 'react-native';
import GridView from 'react-native-super-grid';
import SwipeCards from './SwipeCards';
import { StackNavigator } from 'react-navigation';
import { Easing } from 'react-native';
import { Animated } from 'react-native';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<View style={styles.container}>
<Text style={styles.appTitle}>#PowerHouse</Text>
<View style={[styles.budgetView, styles.grayBG]}>
<Text style={styles.budgetText}>Budget:</Text>
<Text style={[styles.budgetText, styles.boldText]}>$15,000</Text>
</View>
<ModalNavigator />
</View>
);
}
}
class HomeScreen extends Component {
constructor(props) {
super(props)
this.state = { count: 0 }
}
render() {
const items = [
{ name: 'Heating/Cooling System', code: '#1abc9c' },
{ name: 'Laundry', code: '#3498db' },
{ name: 'Fridge', code: '#9b59b6' },
{ name: 'Small Kitchen Appliances', code: '#e74c3c' },
];
const { navigate } = this.props.navigation;
return (
<GridView
itemDimension={130}
items={items}
style={styles.grayBG}
renderItem={item => (
<View>
<TouchableHighlight style={styles.button} onPress={() => navigate("Login")}>
<View style={[styles.itemContainer, { backgroundColor: item.code }]}>
<Text style={styles.itemName}>{item.name}</Text>
</View>
</TouchableHighlight>
</View>
)}
/>
);
}
}
const ModalNavigator = StackNavigator(
{
Main: { screen: HomeScreen },
Login: { screen: SwipeCards },
},
{
headerMode: 'none',
mode: 'modal',
navigationOptions: {
gesturesEnabled: false,
},
transitionConfig: () => ({
transitionSpec: {
duration: 300,
easing: Easing.out(Easing.poly(4)),
timing: Animated.timing,
},
screenInterpolator: sceneProps => {
const { layout, position, scene } = sceneProps;
const { index } = scene;
const height = layout.initHeight;
const translateY = position.interpolate({
inputRange: [index - 1, index, index + 1],
outputRange: [height, 0, 0],
});
const opacity = position.interpolate({
inputRange: [index - 1, index - 0.99, index],
outputRange: [0, 1, 1],
});
return { opacity, transform: [{ translateY }] };
},
}),
}
);
const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: Expo.Constants.statusBarHeight,
},
itemContainer: {
justifyContent: 'center',
borderRadius: 5,
padding: 10,
height: 200,
},
itemName: {
fontSize: 16,
color: '#fff',
fontWeight: '600',
textAlign: 'center'
},
appTitle: {
fontSize: 48,
textAlign: 'center',
margin: 10
},
budgetView: {
padding: 25,
},
budgetText: {
fontSize: 20,
textAlign: 'center'
},
boldText: {
fontWeight: 'bold'
},
grayBG: {
backgroundColor: '#e9e9ef'
}
});