import React from 'react';
import { StackActions, useNavigation } from '@react-navigation/native';
import I18n from '../../i18n';
import { isIOS } from '../../lib/methods/helpers';
import Container from './HeaderButtonContainer';
import Item, { IHeaderButtonItem } from './HeaderButtonItem';
interface IHeaderButtonCommon extends IHeaderButtonItem {
navigation?: any; // TODO: Evaluate proper type
}
// Left
export const Drawer = React.memo(
({ navigation, testID, onPress = () => navigation?.toggleDrawer(), ...props }: IHeaderButtonCommon) => (
)
);
export const CloseModal = React.memo(({ testID, onPress, ...props }: IHeaderButtonCommon) => {
const { dispatch } = useNavigation();
return (
- {
if (onPress) return onPress(arg);
dispatch(StackActions.pop());
}}
testID={testID}
{...props}
/>
);
});
export const CancelModal = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
{isIOS ? (
) : (
)}
));
// Right
export const More = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
));
export const Download = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
));
export const Preferences = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
));
export const Legal = React.memo(
({ navigation, testID, onPress = () => navigation?.navigate('LegalView'), ...props }: IHeaderButtonCommon) => (
)
);