-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
48 lines (46 loc) · 1.5 KB
/
App.js
File metadata and controls
48 lines (46 loc) · 1.5 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import * as React from 'react';
import 'react-native-gesture-handler';
import { StatusBar } from 'expo-status-bar';
import { View, StyleSheet } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import CityList from './CityList';
import WeatherDetailScreen from './WeatherDetailScreen';
const HomeScreen = ({ navigation }) => (
<View style={styles.container}>
<CityList navigation={navigation} />
<StatusBar style="auto" />
</View>
);
const DetailScreen = ({ navigation, route }) => (
<View style={styles.container}>
<WeatherDetailScreen navigation={navigation} route={route} />
<StatusBar style="auto" />
</View>
);
const Stack = createStackNavigator();
const styles = StyleSheet.create({
container: {
flex: 1,
},
});
export default class App extends React.Component {
render() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home">
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ title: 'Cities' }}
/>
<Stack.Screen
name="Detail"
component={DetailScreen}
options={{ title: 'Weather' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
}
}