Skip to content

Commit 331f46e

Browse files
committed
dia 4 - até 2 anos em 2 meses
1 parent e9c4b10 commit 331f46e

21 files changed

+6495
-0
lines changed

mobile/.expo-shared/assets.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
3+
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
4+
}

mobile/.gitignore

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node_modules/**/*
2+
.expo/*
3+
npm-debug.*
4+
*.jks
5+
*.p8
6+
*.p12
7+
*.key
8+
*.mobileprovision
9+
*.orig.*
10+
web-build/
11+
web-report/
12+
13+
# macOS
14+
.DS_Store

mobile/App.tsx

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React from "react";
2+
import { StatusBar } from "react-native";
3+
import Home from "./src/pages/Home";
4+
import { AppLoading } from "expo";
5+
import { Roboto_400Regular, Roboto_500Medium } from "@expo-google-fonts/roboto";
6+
import { Ubuntu_700Bold, useFonts } from "@expo-google-fonts/ubuntu";
7+
8+
import Routes from "./src/routes";
9+
10+
export default function App() {
11+
const [fontsLoaded] = useFonts({
12+
Roboto_400Regular,
13+
Roboto_500Medium,
14+
Ubuntu_700Bold,
15+
});
16+
17+
if (!fontsLoaded) {
18+
return <AppLoading />;
19+
}
20+
21+
return (
22+
<>
23+
<StatusBar
24+
barStyle="dark-content"
25+
backgroundColor="transparent"
26+
translucent
27+
/>
28+
<Routes />
29+
</>
30+
);
31+
}

mobile/app.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"expo": {
3+
"name": "HelloWorld",
4+
"slug": "mobile",
5+
"platforms": [
6+
"ios",
7+
"android",
8+
"web"
9+
],
10+
"version": "1.0.0",
11+
"orientation": "portrait",
12+
"icon": "./assets/icon.png",
13+
"splash": {
14+
"image": "./assets/splash.png",
15+
"resizeMode": "contain",
16+
"backgroundColor": "#ffffff"
17+
},
18+
"updates": {
19+
"fallbackToCacheTimeout": 0
20+
},
21+
"assetBundlePatterns": [
22+
"**/*"
23+
],
24+
"ios": {
25+
"supportsTablet": true
26+
}
27+
}
28+
}

mobile/assets/icon.png

642 Bytes
Loading

mobile/assets/splash.png

9.09 KB
Loading

mobile/babel.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function(api) {
2+
api.cache(true);
3+
return {
4+
presets: ['babel-preset-expo'],
5+
};
6+
};

mobile/package.json

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"main": "node_modules/expo/AppEntry.js",
3+
"scripts": {
4+
"start": "expo start",
5+
"android": "expo start --android",
6+
"ios": "expo start --ios",
7+
"web": "expo start --web",
8+
"eject": "expo eject"
9+
},
10+
"dependencies": {
11+
"@expo-google-fonts/roboto": "^0.1.0",
12+
"@expo-google-fonts/ubuntu": "^0.1.0",
13+
"@react-native-community/masked-view": "0.1.6",
14+
"@react-navigation/native": "^5.5.0",
15+
"@react-navigation/stack": "^5.4.1",
16+
"axios": "^0.19.2",
17+
"expo": "~37.0.3",
18+
"expo-constants": "~9.0.0",
19+
"expo-font": "~8.1.0",
20+
"expo-location": "~8.1.0",
21+
"expo-mail-composer": "~8.1.0",
22+
"react": "~16.9.0",
23+
"react-dom": "~16.9.0",
24+
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
25+
"react-native-gesture-handler": "~1.6.0",
26+
"react-native-maps": "0.26.1",
27+
"react-native-reanimated": "~1.7.0",
28+
"react-native-safe-area-context": "0.7.3",
29+
"react-native-screens": "~2.2.0",
30+
"react-native-svg": "11.0.1",
31+
"react-native-web": "~0.11.7"
32+
},
33+
"devDependencies": {
34+
"@babel/core": "^7.8.6",
35+
"@types/react": "~16.9.23",
36+
"@types/react-native": "~0.61.17",
37+
"babel-preset-expo": "~8.1.0",
38+
"typescript": "~3.8.3"
39+
},
40+
"private": true
41+
}

mobile/src/assets/home-background.png

12 KB
Loading
29.4 KB
Loading
50.1 KB
Loading

mobile/src/assets/logo.png

5.38 KB
Loading

mobile/src/assets/logo@1x.png

5.38 KB
Loading

mobile/src/assets/logo@2x.png

11.1 KB
Loading

mobile/src/pages/Detail/index.tsx

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
import React, { useEffect, useState } from "react";
2+
import {
3+
View,
4+
StyleSheet,
5+
TouchableOpacity,
6+
Image,
7+
Text,
8+
SafeAreaView,
9+
Linking,
10+
} from "react-native";
11+
import Constants from "expo-constants";
12+
import { useNavigation, useRoute } from "@react-navigation/native";
13+
import { Feather as Icon } from "@expo/vector-icons";
14+
import { FontAwesome } from "@expo/vector-icons";
15+
import { RectButton } from "react-native-gesture-handler";
16+
import api from "../../services/api";
17+
import * as MailComposer from "expo-mail-composer";
18+
19+
interface Params {
20+
point_id: number;
21+
}
22+
23+
interface Data {
24+
point: {
25+
image: string;
26+
name: string;
27+
email: string;
28+
whatsapp: string;
29+
city: string;
30+
uf: string;
31+
};
32+
items: { title: string }[];
33+
}
34+
35+
const Detail = () => {
36+
const [data, setData] = useState<Data>({} as Data);
37+
38+
const navigation = useNavigation();
39+
const route = useRoute();
40+
41+
const routeParams = route.params as Params;
42+
43+
useEffect(() => {
44+
api.get<Data>(`/points/${routeParams.point_id}`).then((response) => {
45+
setData(response.data);
46+
});
47+
});
48+
49+
if (!data.point) {
50+
return null;
51+
}
52+
53+
function handleComposeMail() {
54+
MailComposer.composeAsync({
55+
subject: "Interesse na coleta de resíduos",
56+
recipients: [data.point.email],
57+
});
58+
}
59+
60+
function handleSendWhatsapp() {
61+
Linking.openURL(
62+
`whatsapp://send?phone=${data.point.whatsapp}&text=Tenho interesse sobre coleta de resíduos.`
63+
);
64+
}
65+
66+
return (
67+
<SafeAreaView style={{ flex: 1 }}>
68+
<View style={styles.container}>
69+
<TouchableOpacity onPress={() => navigation.goBack()}>
70+
<Icon name="arrow-left" color="#34cb79" size={20} />
71+
</TouchableOpacity>
72+
73+
<Image
74+
style={styles.pointImage}
75+
source={{
76+
uri: data.point.image,
77+
}}
78+
/>
79+
80+
<Text style={styles.pointName}>{data.point.name}</Text>
81+
82+
<Text style={styles.pointItems}>
83+
{data.items.map((item) => item.title).join(", ")}
84+
</Text>
85+
86+
<View style={styles.address}>
87+
<Text style={styles.addressTitle}>Endereço</Text>
88+
<Text style={styles.addressContent}>
89+
{data.point.city}, {data.point.uf}
90+
</Text>
91+
</View>
92+
</View>
93+
<View style={styles.footer}>
94+
<RectButton style={styles.button} onPress={handleSendWhatsapp}>
95+
<FontAwesome name="whatsapp" size={20} color="#FFF" />
96+
<Text style={styles.buttonText}>Whatsapp</Text>
97+
</RectButton>
98+
99+
<RectButton style={styles.button} onPress={handleComposeMail}>
100+
<Icon name="mail" size={20} color="#FFF" />
101+
<Text style={styles.buttonText}>Email</Text>
102+
</RectButton>
103+
</View>
104+
</SafeAreaView>
105+
);
106+
};
107+
108+
export default Detail;
109+
110+
const styles = StyleSheet.create({
111+
container: {
112+
flex: 1,
113+
padding: 32,
114+
paddingTop: 20 + Constants.statusBarHeight,
115+
},
116+
117+
pointImage: {
118+
width: "100%",
119+
height: 120,
120+
resizeMode: "cover",
121+
borderRadius: 10,
122+
marginTop: 32,
123+
},
124+
125+
pointName: {
126+
color: "#322153",
127+
fontSize: 28,
128+
fontFamily: "Ubuntu_700Bold",
129+
marginTop: 24,
130+
},
131+
132+
pointItems: {
133+
fontFamily: "Roboto_400Regular",
134+
fontSize: 16,
135+
lineHeight: 24,
136+
marginTop: 8,
137+
color: "#6C6C80",
138+
},
139+
140+
address: {
141+
marginTop: 32,
142+
},
143+
144+
addressTitle: {
145+
color: "#322153",
146+
fontFamily: "Roboto_500Medium",
147+
fontSize: 16,
148+
},
149+
150+
addressContent: {
151+
fontFamily: "Roboto_400Regular",
152+
lineHeight: 24,
153+
marginTop: 8,
154+
color: "#6C6C80",
155+
},
156+
157+
footer: {
158+
borderTopWidth: StyleSheet.hairlineWidth,
159+
borderColor: "#999",
160+
paddingVertical: 20,
161+
paddingHorizontal: 32,
162+
flexDirection: "row",
163+
justifyContent: "space-between",
164+
},
165+
166+
button: {
167+
width: "48%",
168+
backgroundColor: "#34CB79",
169+
borderRadius: 10,
170+
height: 50,
171+
flexDirection: "row",
172+
justifyContent: "center",
173+
alignItems: "center",
174+
},
175+
176+
buttonText: {
177+
marginLeft: 8,
178+
color: "#FFF",
179+
fontSize: 16,
180+
fontFamily: "Roboto_500Medium",
181+
},
182+
});

0 commit comments

Comments
 (0)