52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import BackIcon from './IconButtons/BackIcon.js';
|
|
import EventsIcon from './IconButtons/EventsIcon.js';
|
|
|
|
export default function HeaderContentLeft({
|
|
activeRoute,
|
|
hasActiveEvent,
|
|
hasMultipleEvents,
|
|
navigation,
|
|
}) {
|
|
const _goBack = () => {
|
|
if (hasActiveEvent) {
|
|
navigation.goBack();
|
|
return false;
|
|
}
|
|
|
|
console.log('nowhere to go...');
|
|
};
|
|
|
|
const _showEvents = () => {
|
|
navigation.navigate('Events');
|
|
return false;
|
|
};
|
|
|
|
if (activeRoute === 'Events') {
|
|
return <EventsIcon action={_goBack} />;
|
|
}
|
|
|
|
if (activeRoute === 'Profile') {
|
|
return <BackIcon action={_goBack} />;
|
|
}
|
|
|
|
if (hasMultipleEvents) {
|
|
return <EventsIcon action={_showEvents} />;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
HeaderContentLeft.propTypes = {
|
|
activeRoute: PropTypes.string.isRequired,
|
|
hasActiveEvent: PropTypes.bool,
|
|
hasMultipleEvents: PropTypes.bool,
|
|
};
|
|
|
|
HeaderContentLeft.defaultProps = {
|
|
hasActiveEvent: false,
|
|
hasMultipleEvents: false,
|
|
};
|