import React from 'react'; import { View, Text, ViewStyle, TouchableOpacity, StyleSheet, Platform, Dimensions, } from 'react-native'; import { StyleGuide } from '../resources/StyleGuide'; import { ImageButton } from './buttons/ImageButton'; import { images } from '../resources/images'; const { width } = Dimensions.get('window'); const styles = StyleSheet.create({ wrapper: { zIndex: 5, backgroundColor: StyleGuide.palette.white, borderColor: StyleGuide.palette.separator, borderBottomWidth: 1, width: '100%', height: 44, }, container: { width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', }, title: { color: StyleGuide.palette.black, fontSize: 14, fontWeight: Platform.OS === 'ios' ? '700' : 'bold', }, rightButtonContainer: { overflow: 'hidden', position: 'absolute', right: 0, borderRadius: 20, height: '100%', alignItems: 'center', justifyContent: 'center', zIndex: 1000, }, leftButtonContainer: { overflow: 'hidden', position: 'absolute', left: 18, borderRadius: 20, }, titleWrapper: { justifyContent: 'center', alignItems: 'center', flex: 1, width: width - 100, }, }); interface Props { onTitlePress?: () => void, title: string, tintColor?: string, onBackPress?: () => void, renderRightButton?: () => React.ReactElement, renderLeftButton?: () => React.ReactElement, wrapperStyle?: ViewStyle | ViewStyle[], } export function Header(props: Props) { const { wrapperStyle, tintColor = StyleGuide.palette.black, onBackPress, renderLeftButton, onTitlePress, title, renderRightButton } = props; return ( {onBackPress ? ( ) : null} {renderLeftButton ? ( {renderLeftButton()} ) : null} {title} {renderRightButton ? ( {renderRightButton()} ) : null} ); }