-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
152 lines (148 loc) · 3.49 KB
/
App.js
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import React from "react";
import { Image, TouchableHighlight } from "react-native";
import Drawer from "react-native-drawer";
import { createStackNavigator, createTabNavigator } from "react-navigation";
import SideBar from "./src/components/SideBar/SideBar";
import EditGreen from "./src/scenes/EditGreen/EditGreen";
import Green from "./src/scenes/Green/Green";
import Home from "./src/scenes/Home/Home";
import Lab from "./src/scenes/Lab/Lab";
import ListGreens from "./src/scenes/ListGreens/ListGreens";
import MyGarden from "./src/scenes/MyGarden/MyGarden";
import Planting from "./src/scenes/Planting/Planting";
import Seeding from "./src/scenes/Seeding/Seeding";
import { colors } from "./src/services/colors";
import NavigationService from "./src/utils/NavigationService";
const TabSelect = createTabNavigator(
{
Green: {
screen: Green,
navigationOptions: {
title: "Ortaggio"
}
},
Seeding: {
screen: Seeding,
navigationOptions: {
title: "Semina"
}
},
Planting: {
screen: Planting,
navigationOptions: {
title: "Trapianta"
}
}
},
{
// tabBarPosition: "bottom",
tabBarOptions: {
style: { backgroundColor: colors.secondary },
labelStyle: {
color: colors.dark,
fontWeight: "bold"
/*
textAlignVertical: 'center',
fontSize: 10*/
},
tabStyle: {
backgroundColor: colors.primary,
borderBottomColor: colors.success
}
}
}
);
const Navigation = createStackNavigator(
{
ListGreens: {
screen: ListGreens
},
Home: {
screen: Home
},
MyGarden: {
screen: MyGarden
},
Lab: {
screen: Lab
},
EditGreen: {
screen: EditGreen
},
Green: {
screen: TabSelect,
navigationOptions: {
title: "Ortaggio"
}
}
},
{
headerMode: "float",
mode: "card",
navigationOptions: ({ navigation }) => ({
headerStyle: {
backgroundColor: colors.primary
},
headerRight: (
<TouchableHighlight
onPress={this.openDrawer}
underlayColor="transparent"
style={{ paddingLeft: 20 }}
>
<Image
style={{ width: 35, height: 35, marginRight: 10 }}
source={require("./src/components/img/black-menu-icon.png")}
/>
</TouchableHighlight>
)
})
}
);
export default class App extends React.Component {
render() {
closeDrawer = () => {
this.drawer.close();
};
openDrawer = () => {
this.drawer.open();
};
return (
<Drawer
type="overlay" //displace:overlay:static
ref={ref => {
this.drawer = ref;
}}
content={<SideBar closeDrawer={closeDrawer} />}
onClose={closeDrawer}
side="right"
openDrawerOffset={120}
negotiatePan={true}
panOpenMask={25}
styles={drawerStyles}
tweenHandler={ratio => ({
main: {
opacity: (2 - ratio) / 2,
backgroundColor: colors.dark
}
})}
elevation={20}
>
<Navigation
style={{ flex: 2 }}
ref={navigatorRef => {
NavigationService.setTopLevelNavigator(navigatorRef);
}}
/>
</Drawer>
);
}
}
const drawerStyles = {
drawer: {
shadowColor: "#000",
shadowOpacity: 0.5,
shadowRadius: 3,
backgroundColor: colors.dark
},
main: { backgroundColor: colors.dark }
};