import React from 'react'; import { StyleSheet, Text, View } from 'react-native'; import PropTypes from 'prop-types'; import { colors, device, fonts } from '../api'; // components import TouchIcon from './TouchIcon'; const ModalHeader = ({ left, leftPress, right, rightPress, style, text }) => ( {left && } {!left && } {text && ( {text} )} {right && ( )} {!right && } ); ModalHeader.defaultProps = { left: null, leftPress: () => null, right: null, rightPress: () => null, style: {}, text: null }; ModalHeader.propTypes = { // optional left: PropTypes.element, leftPress: PropTypes.func, right: PropTypes.element, rightPress: PropTypes.func, style: PropTypes.oneOfType([ PropTypes.array, PropTypes.number, PropTypes.object ]), text: PropTypes.string }; const styles = StyleSheet.create({ container: { flexDirection: 'row', justifyContent: 'space-between', paddingHorizontal: 24, paddingTop: device.iPhoneX ? 48 : 24 }, containerText: { alignItems: 'center', flex: 5, justifyContent: 'center' }, text: { color: colors.white, fontFamily: fonts.spotifyBold, fontSize: 16, textAlign: 'center' }, left: { alignItems: 'flex-start', flex: 1, justifyContent: 'center' }, right: { alignItems: 'flex-end', flex: 1, justifyContent: 'center' } }); export default ModalHeader;