mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-12 13:02:35 +00:00
* 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.
95 lines
2.6 KiB
JavaScript
95 lines
2.6 KiB
JavaScript
// @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,
|
|
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 = ( // eslint-disable-line no-extra-parens
|
|
<View style = { style }>
|
|
{ children }
|
|
<Text style = { styles && styles.labelStyle }>
|
|
{ this.label }
|
|
</Text>
|
|
</View>
|
|
);
|
|
|
|
// XXX As stated earlier, the style was applied to the wrapper View
|
|
// (above).
|
|
style = undefined;
|
|
}
|
|
|
|
return (
|
|
<TouchableHighlight
|
|
accessibilityLabel = { this.accessibilityLabel }
|
|
disabled = { disabled }
|
|
onPress = { onClick }
|
|
style = { style }
|
|
underlayColor = { styles && styles.underlayColor } >
|
|
{ children }
|
|
</TouchableHighlight>
|
|
);
|
|
}
|
|
}
|