This repository has been archived by the owner on Apr 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.tsx
67 lines (55 loc) · 1.56 KB
/
Main.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
64
65
66
import React from 'react';
import { StyleSheet, View, ImageBackground, Text } from 'react-native';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { RootState, Pokemon } from "./types";
import * as pokemonActions from './src/actions/actions';
import PageIndividual from './src/pages/PageIndividual';
import PageMultiple from './src/pages/PageMultiple';
import Footer from './src/components/Footer';
import HeaderComponent from './src/components/HeaderComponent';
const image = { uri: "https://iili.io/7yJVa4.jpgttps://reactjs.org/logo-og.png" };
interface IMain {
pokemon: Pokemon
}
const Main: React.FC<IMain> = ({
pokemon
}) => {
return (
<View style={styles.container}>
<ImageBackground
source={image}
resizeMode="cover"
style={styles.image}
imageStyle={{ opacity: 0.4 }}>
<HeaderComponent />
{
(pokemon) ?
<PageIndividual /> :
<PageMultiple />
}
</ImageBackground>
<Footer />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
},
image: {
flex: 1,
},
});
const mapStateToProps = (state: RootState) => ({
pokemon: state.pokemon,
});
const ActionCreators = Object.assign(
{},
pokemonActions,
);
const mapDispatchToProps = (dispatch: any) => ({
actions: bindActionCreators(ActionCreators, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(Main)