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';
|
2022-07-06 13:23:02 +00:00
|
|
|
import Item, { IHeaderButtonItem } from './HeaderButtonItem';
|
2021-09-13 20:41:05 +00:00
|
|
|
|
2022-07-06 13:23:02 +00:00
|
|
|
interface IHeaderButtonCommon extends IHeaderButtonItem {
|
2022-03-24 19:55:01 +00:00
|
|
|
navigation?: any; // TODO: Evaluate proper type
|
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>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-07-06 13:23:02 +00:00
|
|
|
export const CancelModal = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<Container left>
|
|
|
|
{isIOS ? (
|
2022-07-06 13:23:02 +00:00
|
|
|
<Item title={I18n.t('Cancel')} onPress={onPress} testID={testID} {...props} />
|
2021-09-13 20:41:05 +00:00
|
|
|
) : (
|
2022-07-06 13:23:02 +00:00
|
|
|
<Item iconName='close' onPress={onPress} testID={testID} {...props} />
|
2021-09-13 20:41:05 +00:00
|
|
|
)}
|
|
|
|
</Container>
|
|
|
|
));
|
|
|
|
|
|
|
|
// Right
|
2022-07-06 13:23:02 +00:00
|
|
|
export const More = React.memo(({ onPress, testID, ...props }: IHeaderButtonCommon) => (
|
2021-09-13 20:41:05 +00:00
|
|
|
<Container>
|
2022-07-06 13:23:02 +00:00
|
|
|
<Item iconName='kebab' onPress={onPress} testID={testID} {...props} />
|
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(
|
2022-07-06 13:23:02 +00:00
|
|
|
({ navigation, testID, onPress = () => navigation?.navigate('LegalView'), ...props }: IHeaderButtonCommon) => (
|
|
|
|
<More onPress={onPress} testID={testID} {...props} />
|
2022-03-25 14:35:25 +00:00
|
|
|
)
|
|
|
|
);
|