-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close issue #29, navigation between screens improvement
- Loading branch information
1 parent
40048bc
commit 39505cc
Showing
7 changed files
with
341 additions
and
50 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs'; | ||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; | ||
import Home from '../../views/home'; | ||
import Profile from '../../views/profile'; | ||
import { Dimensions } from 'react-native' | ||
import RecordsList from '../../views/RecordsList'; | ||
|
||
const Tab = createMaterialBottomTabNavigator<RoutesList>(); | ||
const SCREEN_WIDTH = Dimensions.get("window").width; | ||
const iconSize = SCREEN_WIDTH * 0.07; | ||
|
||
export default function BottomNavigation() { | ||
return ( | ||
<Tab.Navigator | ||
shifting | ||
initialRouteName="Home" | ||
activeColor="#E1948B" | ||
inactiveColor="#292B2D" | ||
barStyle={{ | ||
backgroundColor: '#FCFCFF', | ||
position: 'absolute', | ||
overflow: 'hidden', | ||
borderTopLeftRadius: 30, | ||
borderTopRightRadius: 30, | ||
|
||
}} | ||
|
||
> | ||
<Tab.Screen name="Home" component={Home} options={{ | ||
tabBarLabel: 'Início', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="home-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
<Tab.Screen name="History" component={RecordsList} options={{ | ||
tabBarLabel: 'Histórico', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="file-document-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
<Tab.Screen name="Profile" component={Profile} options={{ | ||
tabBarLabel: 'Perfil', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="account-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
</Tab.Navigator > | ||
); | ||
} | ||
|
||
type RoutesList = { | ||
Home: undefined; | ||
History: undefined; | ||
Profile: undefined; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,27 @@ | ||
import React from 'react'; | ||
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs'; | ||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; | ||
import Home from './views/home' | ||
import Profile from './views/profile'; | ||
import { NavigationContainer } from '@react-navigation/native'; | ||
import { Dimensions } from 'react-native' | ||
import RecordsList from './views/RecordsList'; | ||
import { createStackNavigator } from '@react-navigation/stack'; | ||
import EditProfile from './views/editProfile'; | ||
import BottomNavigation from './components/BottomNavigation'; | ||
|
||
const Tab = createMaterialBottomTabNavigator<RoutesList>(); | ||
const SCREEN_WIDTH = Dimensions.get("window").width; | ||
const iconSize = SCREEN_WIDTH * 0.07; | ||
const Stack = createStackNavigator<RootStackParamList>(); | ||
|
||
export default function Routes() { | ||
return ( | ||
<NavigationContainer> | ||
<Tab.Navigator | ||
shifting | ||
initialRouteName="Home" | ||
activeColor="#E1948B" | ||
inactiveColor="#292B2D" | ||
barStyle={{ | ||
backgroundColor: '#FCFCFF', | ||
position: 'absolute', | ||
overflow: 'hidden', | ||
borderTopLeftRadius: 30, | ||
borderTopRightRadius: 30, | ||
|
||
<Stack.Navigator | ||
screenOptions={{ | ||
headerShown: false | ||
}} | ||
|
||
> | ||
<Tab.Screen name="Home" component={Home} options={{ | ||
tabBarLabel: 'Início', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="home-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
<Tab.Screen name="History" component={RecordsList} options={{ | ||
tabBarLabel: 'Histórico', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="file-document-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
<Tab.Screen name="Profile" component={Profile} options={{ | ||
tabBarLabel: 'Perfil', | ||
tabBarIcon: ({ color }) => ( | ||
<MaterialCommunityIcons name="account-outline" color={color} size={iconSize} /> | ||
), | ||
}} /> | ||
</Tab.Navigator > | ||
<Stack.Screen name='BottomNavigation' component={BottomNavigation} /> | ||
<Stack.Screen name='EditProfile' component={EditProfile} /> | ||
</Stack.Navigator> | ||
</NavigationContainer> | ||
); | ||
} | ||
|
||
type RoutesList = { | ||
Home: undefined; | ||
History: undefined; | ||
Profile: undefined; | ||
type RootStackParamList = { | ||
BottomNavigation: undefined | ||
EditProfile: undefined | ||
}; |
Oops, something went wrong.