-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
69 lines (66 loc) · 2.54 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
import React from 'react';
import { StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import ProductsList from './screen/ProductsList.js';
import ProductDetails from './screen/ProductDetails.js';
import Cart from './screen/Cart.js';
import CartIcon from './Component/CartIcon';
import CartProvider from './Cart/CartContext';
import Login from './screen/Login';
import Cadastro from './screen/Cadastro';
import TelaMenu from './screen/TelaMenu';
import Pagamento from './screen/Pagamento';
import {OleoScript_400Regular, useFonts} from '@expo-google-fonts/oleo-script';
import {Roboto_400Regular} from '@expo-google-fonts/roboto';
import AppLoading from 'expo-app-loading';
const Stack = createStackNavigator();
function MyStack() {
return (
<CartProvider>
<Stack.Navigator>
<Stack.Screen options={{ headerTransparent: true, headerShown:false}} name="Login" component={Login} />
<Stack.Screen options={{ headerTransparent: true, headerShown:false}} name="Cadastro" component={Cadastro}/>
<Stack.Screen options={{ headerTransparent: true, headerShown:false}} name="TelaMenu" component={TelaMenu}/>
<Stack.Screen options={{ headerTransparent: true, headerShown:false}} name="Pagamento" component={Pagamento}/>
<Stack.Screen name='ProductsList' component={ProductsList}
options={({ navigation }) => ({
title: 'Produtos',
headerTitleStyle: styles.headerTitle,
headerRight: () => <CartIcon navigation={navigation}/>
})}/>
<Stack.Screen name='ProductDetails' component={ProductDetails}
options={({ navigation }) => ({
title: 'Detalhes Produto',
headerTitleStyle: styles.headerTitle,
headerRight: () => <CartIcon navigation={navigation}/>,
})} />
<Stack.Screen name='Cart' component={Cart}
options={({ navigation }) => ({
title: 'Carrinho',
headerTitleStyle: styles.headerTitle,
headerRight: () => <CartIcon navigation={navigation}/>,
})} />
</Stack.Navigator>
</CartProvider>
);
}
const styles = StyleSheet.create({
headerTitle: {
fontSize: 20
}
});
export default function App() {
let [fontsLoaded] = useFonts({
OleoScript_400Regular,
Roboto_400Regular
});
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<NavigationContainer>
<MyStack />
</NavigationContainer>
);
}