Skip to content

Commit

Permalink
ecoleta mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
jeisonBorba committed Jun 5, 2020
1 parent ef071a4 commit 425205d
Show file tree
Hide file tree
Showing 22 changed files with 12,284 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mobile/.expo-shared/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}
14 changes: 14 additions & 0 deletions mobile/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules/**/*
.expo/*
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
web-report/

# macOS
.DS_Store
26 changes: 26 additions & 0 deletions mobile/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import { AppLoading } from 'expo';
import { StatusBar } from 'react-native';
import { Roboto_400Regular, Roboto_500Medium } from '@expo-google-fonts/roboto';
import { Ubuntu_700Bold, useFonts } from '@expo-google-fonts/ubuntu';

import Routes from './src/routes';

export default function App() {
const [fontsLoaded] = useFonts({
Roboto_400Regular,
Roboto_500Medium,
Ubuntu_700Bold
});

if (!fontsLoaded) {
return <AppLoading />;
}

return (
<>
<StatusBar barStyle="dark-content" backgroundColor="transparent" translucent />
<Routes />
</>
);
}
28 changes: 28 additions & 0 deletions mobile/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"expo": {
"name": "mobile",
"slug": "mobile",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}
Binary file added mobile/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions mobile/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
};
42 changes: 42 additions & 0 deletions mobile/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@expo-google-fonts/roboto": "^0.1.0",
"@expo-google-fonts/ubuntu": "^0.1.0",
"@react-native-community/masked-view": "0.1.6",
"@react-navigation/native": "^5.5.0",
"@react-navigation/stack": "^5.4.1",
"axios": "^0.19.2",
"expo": "~37.0.3",
"expo-constants": "~9.0.0",
"expo-font": "~8.1.0",
"expo-location": "~8.1.0",
"expo-mail-composer": "~8.1.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-gesture-handler": "~1.6.0",
"react-native-maps": "0.26.1",
"react-native-picker-select": "^7.0.0",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "0.7.3",
"react-native-screens": "~2.2.0",
"react-native-svg": "11.0.1",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "^7.8.6",
"@types/react": "~16.9.23",
"@types/react-native": "~0.61.17",
"babel-preset-expo": "^8.2.1",
"typescript": "~3.8.3"
},
"private": true
}
Binary file added mobile/src/assets/home-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/assets/home-background@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/assets/home-background@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/assets/logo@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added mobile/src/assets/logo@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
167 changes: 167 additions & 0 deletions mobile/src/pages/Detail/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, TouchableOpacity, Image, Text, SafeAreaView, Linking } from 'react-native';
import { useNavigation, useRoute } from '@react-navigation/native';
import Constants from 'expo-constants';
import { Feather as Icon, FontAwesome } from '@expo/vector-icons';
import { RectButton} from 'react-native-gesture-handler';
import * as MailComposer from 'expo-mail-composer';

import api from '../../services/api';

interface RouteParams {
point_id: number;
}

interface Data {
point: {
image: string;
image_url: string;
name: string;
email: string;
whatsapp: string;
city: string;
uf: string;
};
items: {
title: string;
}[];
}

const Detail = () => {
const [data, setData] = useState<Data>({} as Data);

const navigation = useNavigation();
const route = useRoute();

const routeParams = route.params as RouteParams;

useEffect(() => {
api.get(`points/${routeParams.point_id}`).then(response => setData(response.data));
}, []);

const handleComposeMail = () => {
MailComposer.composeAsync({
subject: 'Interesse na coleta de resíduos',
recipients: [data.point.email],
});
}

const handleWhatsapp = () => {
Linking.openURL(`whatsapp://send?phone=${data.point.whatsapp}&text=Tenho interesse na coleta de resíduos`)
}

const handleNavigateBack = () => {
navigation.goBack();
}

if (!data.point) {
return null;
}

return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<TouchableOpacity onPress={handleNavigateBack}>
<Icon name="arrow-left" size={20} color="#34cb79" />
</TouchableOpacity>

<Image style={styles.pointImage} source={{ uri: data.point.image_url }} />
<Text style={styles.pointName}>{data.point.name}</Text>
<Text style={styles.pointItems}>{data.items.map(item => item.title).join(',')}</Text>

<View style={styles.address}>
<Text style={styles.addressTitle}>Endereço</Text>
<Text style={styles.addressContent}>{data.point.city}, {data.point.uf}</Text>
</View>
</View>

<View style={styles.footer}>
<RectButton style={styles.button} onPress={handleWhatsapp}>
<FontAwesome name="whatsapp" size={20} color="#FFF" />
<Text style={styles.buttonText} >Whatsapp</Text>
</RectButton>

<RectButton style={styles.button} onPress={handleComposeMail}>
<Icon name="mail" size={20} color="#FFF" />
<Text style={styles.buttonText} >E-mail</Text>
</RectButton>
</View>
</SafeAreaView>
);
};

export default Detail;

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 32,
paddingTop: 20 + Constants.statusBarHeight,
},

pointImage: {
width: '100%',
height: 120,
resizeMode: 'cover',
borderRadius: 10,
marginTop: 32,
},

pointName: {
color: '#322153',
fontSize: 28,
fontFamily: 'Ubuntu_700Bold',
marginTop: 24,
},

pointItems: {
fontFamily: 'Roboto_400Regular',
fontSize: 16,
lineHeight: 24,
marginTop: 8,
color: '#6C6C80'
},

address: {
marginTop: 32,
},

addressTitle: {
color: '#322153',
fontFamily: 'Roboto_500Medium',
fontSize: 16,
},

addressContent: {
fontFamily: 'Roboto_400Regular',
lineHeight: 24,
marginTop: 8,
color: '#6C6C80'
},

footer: {
borderTopWidth: StyleSheet.hairlineWidth,
borderColor: '#999',
paddingVertical: 20,
paddingHorizontal: 32,
flexDirection: 'row',
justifyContent: 'space-between'
},

button: {
width: '48%',
backgroundColor: '#34CB79',
borderRadius: 10,
height: 50,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center'
},

buttonText: {
marginLeft: 8,
color: '#FFF',
fontSize: 16,
fontFamily: 'Roboto_500Medium',
},
});
Loading

0 comments on commit 425205d

Please sign in to comment.