Restore call reactions click outside to dismiss

This commit is contained in:
ayumi-signal 2024-01-24 09:33:20 -08:00 committed by GitHub
parent 36c834ea26
commit 7065ef0885
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,6 +71,7 @@ import {
PersistentCallingToast, PersistentCallingToast,
useCallingToasts, useCallingToasts,
} from './CallingToast'; } from './CallingToast';
import { handleOutsideClick } from '../util/handleOutsideClick';
import { Spinner } from './Spinner'; import { Spinner } from './Spinner';
import type { Props as ReactionPickerProps } from './conversation/ReactionPicker'; import type { Props as ReactionPickerProps } from './conversation/ReactionPicker';
import type { SmartReactionPicker } from '../state/smart/ReactionPicker'; import type { SmartReactionPicker } from '../state/smart/ReactionPicker';
@ -328,6 +329,22 @@ export function CallScreen({
}; };
}, [toggleAudio, toggleVideo]); }, [toggleAudio, toggleVideo]);
useEffect(() => {
if (!showReactionPicker) {
return noop;
}
return handleOutsideClick(
() => {
setShowReactionPicker(false);
return true;
},
{
containerElements: [reactButtonRef, reactionPickerContainerRef],
name: 'CallScreen.reactionPicker',
}
);
}, [showReactionPicker]);
useScreenSharingStoppedToast({ activeCall, i18n }); useScreenSharingStoppedToast({ activeCall, i18n });
useViewModeChangedToast({ activeCall, i18n }); useViewModeChangedToast({ activeCall, i18n });