jiti-meet/react/features/mobile/navigation/components/HeaderNavigationButton.js

87 lines
2.4 KiB
JavaScript
Raw Normal View History

import React from 'react';
import { Text, TouchableRipple } from 'react-native-paper';
import { Icon } from '../../../base/icons';
2022-06-09 14:23:56 +00:00
import type { StyleType } from '../../../base/styles';
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
import { navigationStyles } from './styles';
type Props = {
2022-06-09 14:23:56 +00:00
/**
* Style of the header button .
*/
buttonStyle?: StyleType,
/**
* Is the button disabled?
*/
disabled?: boolean,
/**
* Label of the button.
*/
label?: string,
/**
* Callback to invoke when the {@code HeaderNavigationButton} is clicked/pressed.
*/
onPress?: Function,
/**
* The ImageSource to be rendered as image.
*/
src?: Object,
/**
* Header has two actions.
*/
twoActions?: boolean
}
const HeaderNavigationButton
= ({
2022-06-09 14:23:56 +00:00
buttonStyle,
disabled,
label,
onPress,
src,
twoActions
}: Props) =>
(
<>
{
src ? (
<TouchableRipple
onPress = { onPress }
2022-06-09 14:23:56 +00:00
style = { [
buttonStyle,
navigationStyles.headerNavigationButtonIcon ] } >
<Icon
color = { BaseTheme.palette.link01Active }
size = { 24 }
src = { src }
style = { navigationStyles.headerNavigationIcon } />
</TouchableRipple>
) : (
<TouchableRipple
disabled = { disabled }
onPress = { onPress }
style = { navigationStyles.headerNavigationButtonText } >
<Text
style = {
twoActions
? navigationStyles.headerNavigationTextBold
: navigationStyles.headerNavigationText
}>
{ label }
</Text>
</TouchableRipple>
)}
</>
);
export default HeaderNavigationButton;