-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavigation.tsx
More file actions
34 lines (29 loc) · 1.03 KB
/
Copy pathNavigation.tsx
File metadata and controls
34 lines (29 loc) · 1.03 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
import React from 'react';
import { DarkTheme, DefaultTheme, NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import HomeScreen from './Screens/HomeScreen';
import WeatherScreen from './Screens/WeatherScreen';
import { RootStackParamList } from './Types/Types';
import { useColorScheme } from 'react-native';
const Stack = createNativeStackNavigator<RootStackParamList>();
const AppNavigator = () => {
const theme = useColorScheme();
const isdarktheme = theme === 'dark';
return (
<NavigationContainer theme={isdarktheme ? DarkTheme : DefaultTheme}>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Weather"
component={WeatherScreen}
options={{ title: 'Weather' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
};
export default AppNavigator;