Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jitsi-meet/react/features/base/toolbox/components/ToolboxItem.native.js

97 lines
2.6 KiB

// @flow
import React from 'react';
import { Text, TouchableHighlight, View } from 'react-native';
import { Icon } from '../../../base/font-icons';
import AbstractToolboxItem from './AbstractToolboxItem';
import type { Props } from './AbstractToolboxItem';
/**
* Native implementation of {@code AbstractToolboxItem}.
*/
export default class ToolboxItem extends AbstractToolboxItem<Props> {
/**
* Transform the given (web) icon name into a name that works with
* {@code Icon}.
*
* @private
* @returns {string}
*/
_getIconName() {
const { iconName } = this.props;
return iconName.replace('icon-', '').split(' ')[0];
}
/**
* Renders the {@code Icon} part of this {@code ToolboxItem}.
*
* @private
* @returns {ReactElement}
*/
_renderIcon() {
const { styles } = this.props;
return (
<Icon
name = { this._getIconName() }
style = { styles && styles.iconStyle } />
);
}
/**
* Renders this {@code ToolboxItem}. Invoked by {@link AbstractToolboxItem}.
*
* @override
* @protected
* @returns {ReactElement}
*/
_renderItem() {
const {
disabled,
elementAfter,
onClick,
showLabel,
styles
} = this.props;
let children = this._renderIcon();
// XXX When using a wrapper View, apply the style to it instead of
// applying it to the TouchableHighlight.
let style = styles && styles.style;
if (showLabel) {
// XXX TouchableHighlight requires 1 child. If there's a need to
// show both the icon and the label, then these two need to be
// wrapped in a View.
children = (
<View style = { style }>
{ children }
<Text style = { styles && styles.labelStyle }>
{ this.label }
</Text>
{ elementAfter }
</View>
);
// XXX As stated earlier, the style was applied to the wrapper View
// (above).
style = undefined;
}
return (
<TouchableHighlight
fix(i18n) Accessiblity labels translations (#3071) * fix(toolbar): accessibilityLabel should be translatable. This commit adds a helper property to get the accessibilityLabel of an item, providing a translation if one is available. This mimics the behavior of label and tooltip. * fix(toolbar) 'hangup' button accessibilityLabel i18n * fix(toolbar) 'mute' button accessibilityLabel i18n * fix(toolbar) 'videomute' button accessibilityLabel i18n * fix(toolbar) 'moreActions' button accessibilityLabel i18n * fix(toolbar) 'shareRoom' button accessibilityLabel i18n * fix(toolbar) 'audioRoute' button accessibilityLabel i18n * fix(toolbar) 'toggleCamera' button accessibilityLabel i18n * fix(toolbar) 'audioOnly' button accessibilityLabel i18n * fix(toolbar) 'roomLock' button accessibilityLabel i18n * fix(toolbar) 'pip' button accessibilityLabel i18n * fix(toolbar) 'invite' button accessibilityLabel i18n * fix(toolbar) 'raiseHand' button accessibilityLabel i18n * fix(toolbar) 'chat' button accessibilityLabel i18n * fix(toolbar) 'shareYourScreen' button accessibilityLabel i18n * fix(toolbar) 'fullScreen' button accessibilityLabel i18n * fix(toolbar) 'sharedvideo' button accessibilityLabel i18n * fix(toolbar) 'document' button accessibilityLabel i18n * fix(toolbar) 'speakerStats' button accessibilityLabel i18n * fix(toolbar) 'feedback' button accessibilityLabel i18n * fix(toolbar) 'shortcuts' button accessibilityLabel i18n * fix(toolbar) 'recording' button accessibilityLabel i18n * fix(toolbar) 'settings' button accessibilityLabel i18n * fix(welcomepage) accessibilityLabels i18n * fix(toolbar) 'info' button accessibilityLabel i18n * fix(i18n): Add translation to various aria-label property values. * fix(i18n): Differentiate between overflow menu and button.
8 years ago
accessibilityLabel = { this.accessibilityLabel }
disabled = { disabled }
onPress = { onClick }
style = { style }
underlayColor = { styles && styles.underlayColor } >
{ children }
</TouchableHighlight>
);
}
}