-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
63 lines (56 loc) · 1.59 KB
/
App.tsx
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React, {useEffect} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import HomeScreen from './src/components/HomeScreen';
import DetailsScreen from './src/components/DetailsScreen';
import {getWeather} from './src/store/actions/weather';
import {useDispatch} from 'react-redux';
import {INITIAL_CITY} from './src/store/constants';
import {Image} from 'react-native';
const Tabs = createBottomTabNavigator();
const App = () => {
const dispatch = useDispatch();
useEffect(() => {
dispatch(getWeather(INITIAL_CITY));
}, [dispatch]);
return (
<NavigationContainer>
<Tabs.Navigator>
<Tabs.Screen
name="Home"
component={HomeScreen}
options={{
tabBarIcon: () => (
<Image
source={require('./assets/home.png')}
style={{width: 20, height: 20}}
/>
),
}}
/>
<Tabs.Screen
name="Details"
component={DetailsScreen}
options={{
tabBarIcon: () => (
<Image
source={require('./assets/search.png')}
style={{width: 20, height: 20}}
/>
),
}}
/>
</Tabs.Navigator>
</NavigationContainer>
);
};
export default App;