2021-07-13 06:50:08 +00:00
|
|
|
// @flow
|
|
|
|
|
2022-03-30 13:54:03 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { Image, View } from 'react-native';
|
2021-07-13 06:50:08 +00:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
|
|
|
import { ColorSchemeRegistry } from '../../../base/color-scheme';
|
2022-03-30 13:54:03 +00:00
|
|
|
import { isGifEnabled } from '../../../gifs/functions';
|
|
|
|
import { navigate } from '../../../mobile/navigation/components/conference/ConferenceNavigationContainerRef';
|
|
|
|
import { screen } from '../../../mobile/navigation/routes';
|
2021-07-13 06:50:08 +00:00
|
|
|
import { REACTIONS } from '../../constants';
|
|
|
|
|
|
|
|
import RaiseHandButton from './RaiseHandButton';
|
|
|
|
import ReactionButton from './ReactionButton';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link ReactionMenu}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to close the overflow menu after raise hand is clicked.
|
|
|
|
*/
|
|
|
|
onCancel: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not it's displayed in the overflow menu.
|
|
|
|
*/
|
|
|
|
overflowMenu: boolean
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Animated reaction emoji.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
function ReactionMenu({
|
|
|
|
onCancel,
|
|
|
|
overflowMenu
|
|
|
|
}: Props) {
|
|
|
|
const _styles = useSelector(state => ColorSchemeRegistry.get(state, 'Toolbox'));
|
2022-03-30 13:54:03 +00:00
|
|
|
const gifEnabled = useSelector(isGifEnabled);
|
|
|
|
|
|
|
|
const openGifMenu = useCallback(() => {
|
|
|
|
navigate(screen.conference.gifsMenu);
|
|
|
|
onCancel();
|
|
|
|
}, []);
|
2021-07-13 06:50:08 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<View style = { overflowMenu ? _styles.overflowReactionMenu : _styles.reactionMenu }>
|
2021-09-14 08:15:03 +00:00
|
|
|
<View style = { _styles.reactionRow }>
|
2022-07-07 12:29:18 +00:00
|
|
|
{
|
|
|
|
Object.keys(REACTIONS).map(key => (
|
|
|
|
<ReactionButton
|
|
|
|
key = { key }
|
|
|
|
reaction = { key }
|
|
|
|
styles = { _styles.reactionButton } />
|
|
|
|
))
|
|
|
|
}
|
|
|
|
{
|
|
|
|
gifEnabled && (
|
|
|
|
<ReactionButton
|
|
|
|
onClick = { openGifMenu }
|
|
|
|
styles = { _styles.reactionButton }>
|
|
|
|
<Image
|
|
|
|
height = { 22 }
|
|
|
|
source = { require('../../../../../images/GIPHY_icon.png') } />
|
|
|
|
</ReactionButton>
|
|
|
|
)
|
|
|
|
}
|
2021-09-14 08:15:03 +00:00
|
|
|
</View>
|
2021-07-13 06:50:08 +00:00
|
|
|
<RaiseHandButton onCancel = { onCancel } />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ReactionMenu;
|