1
- import { StyleSheet , Text , View } from 'react-native' ;
2
- import * as Sentry from '@sentry/react-native' ;
1
+ import React from 'react' ;
2
+
3
+ import { View , Text , TouchableOpacity , StyleSheet , Animated } from 'react-native' ;
4
+
5
+ import { createDrawerNavigator } from '@react-navigation/drawer' ;
6
+ import { NavigationContainer } from '@react-navigation/native' ;
7
+ import { MaterialIcons } from '@expo/vector-icons' ;
8
+
3
9
import Constants from 'expo-constants' ;
4
10
5
- import { Home } from '@screens/Home/Home' ;
11
+ import * as Sentry from '@sentry/react-native' ;
12
+
13
+ import { HomeScreen } from '@screens/Home/Home' ;
14
+ import { RoversScreen } from '@screens/Rovers/Rovers' ;
15
+ import { GalaxiesScreen } from '@screens/Galaxies/Galaxies' ;
16
+
17
+ import { Colors } from '@consts/consts' ;
6
18
7
19
// Acessando as variáveis definidas no .env
8
20
const sentryDsn = Constants . manifest2 ?. extra ?. expoClient ?. extra ?. sentryDsn ;
@@ -12,12 +24,81 @@ Sentry.init({
12
24
debug : true , // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production
13
25
} ) ;
14
26
15
- function App ( ) {
27
+ const Drawer = createDrawerNavigator ( ) ;
28
+
29
+ // Menu lateral
30
+ const CustomDrawerContent = ( { navigation } : any ) => {
16
31
return (
17
- < View className = "flex-1 items-center justify-center bg-white" >
18
- < Home />
32
+ < View style = { styles . drawerContainer } >
33
+ < TouchableOpacity style = { styles . drawerButton } onPress = { ( ) => navigation . navigate ( 'Home' ) } >
34
+ < Text style = { styles . drawerText } > Home</ Text >
35
+ </ TouchableOpacity >
36
+ < TouchableOpacity style = { styles . drawerButton } onPress = { ( ) => navigation . navigate ( 'Galaxies' ) } >
37
+ < Text style = { styles . drawerText } > Galaxies</ Text >
38
+ </ TouchableOpacity >
39
+ < TouchableOpacity style = { styles . drawerButton } onPress = { ( ) => navigation . navigate ( 'Rovers' ) } >
40
+ < Text style = { styles . drawerText } > Rovers</ Text >
41
+ </ TouchableOpacity >
19
42
</ View >
20
43
) ;
44
+ } ;
45
+
46
+ const screenOptions = ( { navigation } : any ) => ( {
47
+ headerStyle : {
48
+ backgroundColor : '#1a1a1a' , // Cor do header
49
+ } ,
50
+ headerTitleStyle : {
51
+ fontSize : 24 ,
52
+ } ,
53
+ headerTintColor : Colors . purple , // Cor do texto e ícones no header
54
+ headerLeft : ( ) => (
55
+ < TouchableOpacity
56
+ style = { {
57
+ marginLeft : 10 ,
58
+ } }
59
+ onPress = { ( ) => navigation . toggleDrawer ( ) }
60
+ >
61
+ < MaterialIcons name = "menu" size = { 30 } color = { Colors . purple } />
62
+ </ TouchableOpacity >
63
+ ) ,
64
+ } ) ;
65
+
66
+ // Navegação com Menu Lateral
67
+ const AppNavigator = ( ) => {
68
+ return (
69
+ < Drawer . Navigator drawerContent = { ( props ) => < CustomDrawerContent { ...props } /> } >
70
+ < Drawer . Screen name = "Home" component = { HomeScreen } options = { screenOptions } />
71
+ < Drawer . Screen name = "Galaxies" component = { GalaxiesScreen } options = { screenOptions } />
72
+ < Drawer . Screen name = "Rovers" component = { RoversScreen } options = { screenOptions } />
73
+ </ Drawer . Navigator >
74
+ ) ;
75
+ } ;
76
+
77
+ function App ( ) {
78
+ return (
79
+ < NavigationContainer >
80
+ < AppNavigator />
81
+ </ NavigationContainer >
82
+ ) ;
21
83
}
22
84
23
85
export default Sentry . wrap ( App ) ;
86
+
87
+ const styles = StyleSheet . create ( {
88
+ drawerContainer : {
89
+ flex : 1 ,
90
+ paddingTop : 50 ,
91
+ paddingHorizontal : 20 ,
92
+ backgroundColor : Colors . darkGray ,
93
+ } ,
94
+ drawerButton : {
95
+ marginVertical : 15 ,
96
+ padding : 15 ,
97
+ backgroundColor : Colors . purple ,
98
+ borderRadius : 8 ,
99
+ } ,
100
+ drawerText : {
101
+ fontSize : 18 ,
102
+ color : '#fff' ,
103
+ } ,
104
+ } ) ;
0 commit comments