This commit is contained in:
Mike Fitzpatrick
2019-08-06 14:58:01 -04:00
parent b8ddc54b99
commit 637794ebcd
7 changed files with 58 additions and 43 deletions

View File

@@ -0,0 +1,11 @@
import { connect } from 'react-redux';
import { fetchEvents } from '../../actions/events.js';
import AppHeader from './AppHeader.js';
const matchDispatchToProps = (dispatch) => ({
fetchEvents: () => dispatch(fetchEvents()),
});
export default connect(null, matchDispatchToProps)(AppHeader);

View File

@@ -1,4 +1,4 @@
import React from 'react';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Header } from 'react-native-elements';
@@ -9,17 +9,28 @@ import HeaderContentRight from './HeaderContentRight.container.js';
import styles from './AppHeader.styles.js';
export default function AppHeader({ navigation }) {
return (
<Header
placement="left"
leftComponent={<HeaderContentRight navigation={navigation} />}
centerComponent={<HeaderTitle navigation={navigation} />}
rightComponent={<HeaderContentLeft navigation={navigation} />}
/>
);
}
export default class AppHeader extends Component {
AppHeader.propTypes = {
navigation: PropTypes.func.isRequired,
};
static get propTypes() {
return {
fetchEvents: PropTypes.func.isRequired,
};
}
componentDidMount() {
this.props.fetchEvents();
}
render () {
const { navigation } = this.props;
return (
<Header
placement="left"
leftComponent={<HeaderContentRight navigation={navigation} />}
centerComponent={<HeaderTitle navigation={navigation} />}
rightComponent={<HeaderContentLeft navigation={navigation} />}
/>
);
}
}