import React from 'react';
import { Appbar } from 'react-native-paper';

interface TopBarProps{
    title : string
    isVisible : boolean
}
  
export default function TopBar(props) {
    const _handleSearch = () => console.log('Searching');
    const _handleMore = () => console.log('Shown more');

    return (
        <Appbar.Header  style={{backgroundColor: '#F2F0E4'}} >
            <Appbar.Content title={props.title} />

            {props.isVisible && (
                <>
                    <Appbar.Action icon="magnify" onPress={_handleSearch} />
                    <Appbar.Action icon="dots-vertical" onPress={_handleMore} />
                </>
            )}
        </Appbar.Header>
    );
}