Skip to content

Commit

Permalink
merge navigation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
christophertorres1 committed Dec 7, 2024
1 parent a40062a commit 093eb8d
Show file tree
Hide file tree
Showing 7 changed files with 17,522 additions and 78 deletions.
91 changes: 21 additions & 70 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,75 +1,26 @@
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { DefaultTheme, NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import SvgContactSelected from '@/icons/ContactSelected';
import SvgContactUnselected from '@/icons/ContactUnselected';
import SvgHomeSelected from '@/icons/HomeSelected';
import SvgHomeUnselected from '@/icons/HomeUnselected';
import ContactScreen from '@/screens/contact/ContactScreen';
import LoginScreen from '@/screens/login/LoginScreen';
import TreeSearchScreen from '@/screens/tree_search/TreeSearchScreen';
import { LoginStackParamList } from '@/types/navigation';
import { Text } from 'react-native';
import { useFonts } from 'expo-font';
import { DMSans_400Regular, DMSans_700Bold } from '@expo-google-fonts/dm-sans';
import { DefaultTheme } from '@react-navigation/native';
import AppNavigator from '@/navigation/AppNavigator';
import colors from '@/styles/colors';

DefaultTheme.colors.background = '#FFFFFF';
const LoginStack = createNativeStackNavigator<LoginStackParamList>();
const NavigationTab = createBottomTabNavigator();

function NavigationBar() {
return (
<NavigationTab.Navigator
initialRouteName="TreeSearch"
screenOptions={({ route }) => ({
tabBarShowLabel: false,
tabBarStyle: { paddingTop: 10 },
tabBarIcon: ({ focused }) => {
if (route.name === 'TreeSearch') {
return focused ? (
<SvgHomeSelected width={30} height={30} />
) : (
<SvgHomeUnselected width={30} height={30} />
);
}
if (route.name === 'Contact') {
return focused ? (
<SvgContactSelected width={30} height={30} />
) : (
<SvgContactUnselected width={30} height={30} />
);
}
return null;
},
})}
>
<NavigationTab.Screen
name="TreeSearch"
component={TreeSearchScreen}
options={{ headerShown: false }}
/>
<NavigationTab.Screen
name="Contact"
component={ContactScreen}
options={{ headerShown: false }}
/>
</NavigationTab.Navigator>
);
}
DefaultTheme.colors.background = colors.white;

export default function App() {
return (
<NavigationContainer>
<LoginStack.Navigator initialRouteName="Login">
<LoginStack.Screen
name="Login"
component={LoginScreen}
options={{ headerShown: false }}
/>
<LoginStack.Screen
name="Main"
component={NavigationBar}
options={{ headerShown: false }}
/>
</LoginStack.Navigator>
</NavigationContainer>
);
const [fontsLoaded] = useFonts({
DMSans_400Regular,
DMSans_700Bold,
});

if (!fontsLoaded) {
return null;
}

const defaultFontFamily = 'DMSans_400Regular';
(Text as any).defaultProps = (Text as any).defaultProps || {};
(Text as any).defaultProps.style = { fontFamily: defaultFontFamily };

return <AppNavigator />;
}
Loading

0 comments on commit 093eb8d

Please sign in to comment.