Browse Source

Putting the profile screen to the tabbar and adding the information button to the header bar

master
GabrielTrettel 3 years ago
parent
commit
86c0b059ba
  1. 10
      src/app/components/HeaderBarMenu.js
  2. 53
      src/app/navigation/AppNavigator.js
  3. 1
      src/app/screens/SharingDataScreen.js

10
src/app/components/HeaderBarMenu.js

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { FontAwesome5 } from "@expo/vector-icons";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { import {
HeaderButtons, HeaderButtons,
HeaderButton, HeaderButton,
@ -8,7 +8,7 @@ import {
} from "react-navigation-header-buttons"; } from "react-navigation-header-buttons";
const IoniconsHeaderButton = (props) => ( const IoniconsHeaderButton = (props) => (
<HeaderButton IconComponent={FontAwesome5} iconSize={23} {...props} />
<HeaderButton IconComponent={MaterialCommunityIcons} iconSize={23} {...props} />
); );
function HeaderBarMenu(navigation) { function HeaderBarMenu(navigation) {
@ -17,9 +17,9 @@ function HeaderBarMenu(navigation) {
headerRight: () => ( headerRight: () => (
<HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}> <HeaderButtons HeaderButtonComponent={IoniconsHeaderButton}>
<Item <Item
title="user"
iconName="user"
onPress={() => navigation.navigate("Perfil")}
title="Sobre"
iconName="information-outline"
onPress={() => navigation.navigate("Abbout")}
/> />
</HeaderButtons> </HeaderButtons>
), ),

53
src/app/navigation/AppNavigator.js

@ -10,13 +10,20 @@ import NewListingButton from "./NewListingButton";
import SharingDataOptionsNavigator from "./SharingDataOptionsNavigator"; import SharingDataOptionsNavigator from "./SharingDataOptionsNavigator";
import { NavigationContainer } from "@react-navigation/native"; import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack"; import { createStackNavigator } from "@react-navigation/stack";
import Abbout from "../screens/Abbout";
import colors from "../config/colors";
const Tab = createBottomTabNavigator(); const Tab = createBottomTabNavigator();
const Stack = createStackNavigator(); const Stack = createStackNavigator();
function tabScreens() { function tabScreens() {
return ( return (
<Tab.Navigator style={{ backgroundColor: "white" }}>
<Tab.Navigator
style={{ backgroundColor: "black" }}
tabBarOptions={{
activeTintColor: colors.primary,
}}
>
<Tab.Screen <Tab.Screen
name="Home" name="Home"
component={FeedNavigator} component={FeedNavigator}
@ -49,42 +56,22 @@ function tabScreens() {
), ),
})} })}
/> />
<Tab.Screen <Tab.Screen
name="Previsão"
component={ForecastNavigator}
name="Perfil"
component={AccountNavigator}
options={{ options={{
tabBarIcon: ({ color, size }) => ( tabBarIcon: ({ color, size }) => (
<MaterialCommunityIcons
name="check-circle"
color={color}
size={size}
/>
<MaterialCommunityIcons name="account" color={color} size={size} />
), ),
}} }}
/> />
{/* <Tab.Screen */}
{/* name="Notificação" */}
{/* component={MessagesNavigator} */}
{/* options={{ */}
{/* tabBarIcon: ({ color, size }) => ( */}
{/* <MaterialCommunityIcons */}
{/* name="bell" */}
{/* color={color} */}
{/* size={size} */}
{/* /> */}
{/* ), */}
{/* }} */}
{/* /> */}
</Tab.Navigator> </Tab.Navigator>
); );
} }
const AppNavigator = () => ( const AppNavigator = () => (
<NavigationContainer
independent={true}
>
<NavigationContainer independent={true}>
<Stack.Navigator> <Stack.Navigator>
<Stack.Screen <Stack.Screen
name="tab" name="tab"
@ -93,17 +80,19 @@ const AppNavigator = () => (
/> />
<Stack.Screen <Stack.Screen
name="Perfil"
component={AccountNavigator}
name="Abbout"
component={Abbout}
options={{ options={{
headerShown: false,
title: "Sobre",
tabBarIcon: ({ color, size }) => ( tabBarIcon: ({ color, size }) => (
<MaterialCommunityIcons name="account" color={color} size={size} />
<MaterialCommunityIcons
name="information-outline"
color={color}
size={size}
/>
), ),
}} }}
/> />
</Stack.Navigator> </Stack.Navigator>
</NavigationContainer> </NavigationContainer>
); );

1
src/app/screens/SharingDataScreen.js

@ -9,7 +9,6 @@ import HeaderBarMenu from "../components/HeaderBarMenu";
//1/3 //1/3
function SharingDataScreen({ navigation }) { function SharingDataScreen({ navigation }) {
HeaderBarMenu(navigation);
const dims = scaleDimsFromWidth(93, 106, 35); const dims = scaleDimsFromWidth(93, 106, 35);
// const dims = { width: "100%", height: "100%" }; // const dims = { width: "100%", height: "100%" };

Loading…
Cancel
Save