import React, { useRef, useEffect } from 'react'; import { CallDetailsType } from '../state/ducks/calling'; import { LocalizerType } from '../types/Util'; import { Avatar } from './Avatar'; import { Intl } from './Intl'; import { ContactName } from './conversation/ContactName'; interface Props { callDetails: CallDetailsType; i18n: LocalizerType; close: () => void; } const AUTO_CLOSE_MS = 10000; export const CallNeedPermissionScreen: React.FC = ({ callDetails, i18n, close, }) => { const title = callDetails.title || i18n('unknownContact'); const autoCloseAtRef = useRef(Date.now() + AUTO_CLOSE_MS); useEffect(() => { const timeout = setTimeout(close, autoCloseAtRef.current - Date.now()); return clearTimeout.bind(null, timeout); }, [autoCloseAtRef, close]); return (

]} />

); };