fix(rn,reactions) don't show raise hand button in menu if disabled

This commit is contained in:
Saúl Ibarra Corretgé 2022-05-05 11:57:05 +02:00 committed by Saúl Ibarra Corretgé
parent 0b57bcb20b
commit d1ac4ea637
1 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import {
sendAnalytics
} from '../../../analytics';
import { ColorSchemeRegistry } from '../../../base/color-scheme';
import { RAISE_HAND_ENABLED, getFeatureFlag } from '../../../base/flags';
import { translate } from '../../../base/i18n';
import {
getLocalParticipant,
@ -25,6 +26,11 @@ import { type ReactionStyles } from './ReactionButton';
*/
type Props = AbstractButtonProps & {
/**
* Whether this button is enabled or not.
*/
_enabled: boolean,
/**
* The local participant.
*/
@ -128,7 +134,11 @@ class RaiseHandButton extends Component<Props, *> {
* @returns {ReactElement}
*/
render() {
const { _styles, t } = this.props;
const { _enabled, _styles, t } = this.props;
if (!_enabled) {
return null;
}
return (
<TouchableHighlight
@ -155,8 +165,10 @@ class RaiseHandButton extends Component<Props, *> {
*/
function _mapStateToProps(state): Object {
const _localParticipant = getLocalParticipant(state);
const enabled = getFeatureFlag(state, RAISE_HAND_ENABLED, true);
return {
_enabled: enabled,
_localParticipant,
_raisedHand: hasRaisedHand(_localParticipant),
_styles: ColorSchemeRegistry.get(state, 'Toolbox').raiseHandButton