-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
91 lines (84 loc) · 3.65 KB
/
Copy pathApp.js
File metadata and controls
91 lines (84 loc) · 3.65 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
/* ************************************************************************* *
* Projeto: Cadastro de Produtos *
* Autor: Rafaela F. Savaris *
* Data: 2025 *
* ************************************************************************* *
* Descrição: *
* Este é um aplicativo móvel desenvolvido com React Native e Expo. *
* Permite adicionar, editar e excluir produtos com as seguintes informações:*
* - Nome *
* - Preço *
* - Descrição (opcional) *
* ************************************************************************* *
* Funcionalidades: *
* - Tela Home: lista todos os produtos cadastrados *
* - Tela de Adição: permite cadastrar novos produtos *
* - Tela de Edição: permite atualizar informações de produtos existentes *
* - Banco de dados local: utiliza SQLite via Expo *
* ************************************************************************* *
* Observações: *
* - Feito para ser usado com Expo Go no celular ou em emuladores Android/iOS*
* - Cabeçalho personalizado simples implementado com View e Text *
* ************************************************************************* */
// Importações do React e React Native
import React from 'react';
import { View, Text } from 'react-native';
// Importações do React Navigation
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { Image } from 'react-native';
// Importação das telas do aplicativo
import Home from './src/screens/home';
import AddProductScreen from './src/screens/addProductScreen';
import EditProductScreen from './src/screens/editProductScreen';
// Criação do stack navigator
const Stack = createNativeStackNavigator();
// Personalização do cabeçalho
function HeaderTitle() {
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Image
source={require('./assets/logo.png')}
style={{ width: 40, height: 40, resizeMode: 'contain', marginRight: 8 }}
/>
<Text style={{ color: '#fff', fontSize: 20, fontWeight: 'bold' }}>
Lista de Produtos
</Text>
</View>
);
}
export default function App() {
return (
<NavigationContainer>
{/* Tela inicial do aplicativo */}
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerStyle: { backgroundColor: '#d65a75' },
headerTintColor: '#fff',
}}
>
{/* Tela home */}
<Stack.Screen
name="Home"
component={Home}
options={{
headerTitle: () =>
<HeaderTitle />, }}
/>
{/* Tela de adição de produtos */}
<Stack.Screen
name="AddProductScreen"
component={AddProductScreen}
options={{ title: 'Adicionar Produto' }}
/>
{/* Tela de edição de produtos */}
<Stack.Screen
name="EditProductScreen"
component={EditProductScreen}
options={{ title: 'Editar Produto' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}