2021-09-13 20:41:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
2022-06-06 14:17:51 +00:00
|
|
|
import { isIOS } from '../../lib/methods/helpers';
|
2021-09-13 20:41:05 +00:00
|
|
|
import I18n from '../../i18n';
|
|
|
|
import Container from './HeaderButtonContainer';
|
|
|
|
import Item from './HeaderButtonItem';
|
|
|
|
|
|
|
|
interface IHeaderButtonCommon {
|
2022-03-24 19:55:01 +00:00
|
|
|
navigation?: any; // TODO: Evaluate proper type
|
|
|
|
onPress?: () => void;
|
2021-09-15 19:58:14 +00:00
|
|
|
testID?: string;
|
2021-09-13 20:41:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Left
|
2022-03-24 19:55:01 +00:00
|
|
|
export const Drawer = React.memo(
|
2022-03-25 14:35:25 +00:00
|
|
|
({ navigation, testID, onPress = () => navigation?.toggleDrawer(), ...props }: IHeaderButtonCommon) => (
|
2022-03-24 19:55:01 +00:00
|
|
|
<Container left>
|
|
|
|
<Item iconName='hamburguer' onPress={onPress} testID={testID} {...props} />
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
);
|
2021-09-13 20:41:05 +00:00
|
|
|
|
|
|
|
export const CloseModal = React.memo(
|
2022-03-24 19:55:01 +00:00
|
|
|
({ navigation, testID, onPress = () => navigation?.pop(), ...props }: IHeaderButtonCommon) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<Container left>
|
|
|
|
<Item iconName='close' onPress={onPress} testID={testID} {...props} />
|
|
|
|
</Container>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
export const CancelModal = React.memo(({ onPress, testID }: Partial<IHeaderButtonCommon>) => (
|
|
|
|
<Container left>
|
|
|
|
{isIOS ? (
|
2022-03-24 19:55:01 +00:00
|
|
|
<Item title={I18n.t('Cancel')} onPress={onPress} testID={testID} />
|
2021-09-13 20:41:05 +00:00
|
|
|
) : (
|
2022-03-24 19:55:01 +00:00
|
|
|
<Item iconName='close' onPress={onPress} testID={testID} />
|
2021-09-13 20:41:05 +00:00
|
|
|
)}
|
|
|
|
</Container>
|
|
|
|
));
|
|
|
|
|
|
|
|
// Right
|
|
|
|
export const More = React.memo(({ onPress, testID }: Partial<IHeaderButtonCommon>) => (
|
|
|
|
<Container>
|
2022-03-24 19:55:01 +00:00
|
|
|
<Item iconName='kebab' onPress={onPress} testID={testID} />
|
2021-09-13 20:41:05 +00:00
|
|
|
</Container>
|
|
|
|
));
|
|
|
|
|
2022-03-24 19:55:01 +00:00
|
|
|
export const Download = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<Container>
|
2022-03-24 19:55:01 +00:00
|
|
|
<Item iconName='download' onPress={onPress} testID={testID} {...props} />
|
2021-09-13 20:41:05 +00:00
|
|
|
</Container>
|
|
|
|
));
|
|
|
|
|
2022-03-24 19:55:01 +00:00
|
|
|
export const Preferences = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<Container>
|
2022-03-24 19:55:01 +00:00
|
|
|
<Item iconName='settings' onPress={onPress} testID={testID} {...props} />
|
2021-09-13 20:41:05 +00:00
|
|
|
</Container>
|
|
|
|
));
|
|
|
|
|
2022-03-25 14:35:25 +00:00
|
|
|
export const Legal = React.memo(
|
|
|
|
({ navigation, testID, onPress = () => navigation?.navigate('LegalView') }: IHeaderButtonCommon) => (
|
|
|
|
<More onPress={onPress} testID={testID} />
|
|
|
|
)
|
|
|
|
);
|