import React from 'react'; import { StyleSheet, Text, View, type ViewStyle } from 'react-native'; import { UserInfo } from './UserInfo'; import { Z_INDEX } from '../../../constants'; import { useCallStateHooks, useI18n } from '@stream-io/video-react-bindings'; import { useTheme } from '../../../contexts/ThemeContext'; import { OutgoingCallControls as DefaultOutgoingCallControls, type OutgoingCallControlsProps, } from '../CallControls'; import { LobbyCameraPreview } from '../Lobby'; /** * Props for the OutgoingCall Component. */ export type OutgoingCallProps = OutgoingCallControlsProps & { /** * Prop to customize the OutgoingCall controls. */ OutgoingCallControls?: React.ComponentType | null; /** * Check if device is in landscape mode. * This will apply the landscape mode styles to the component. */ landscape?: boolean; }; /** * An outgoing call with the callee's avatar, name, caller's camera in background, reject and mute buttons. * Used after the user has initiated a call. */ export const OutgoingCall = ({ onHangupCallHandler, OutgoingCallControls = DefaultOutgoingCallControls, landscape, }: OutgoingCallProps) => { const { theme: { colors, typefaces, outgoingCall, variants }, } = useTheme(); const { t } = useI18n(); const landscapeContentStyles: ViewStyle = { flexDirection: landscape ? 'row' : 'column', }; const insetStyles: ViewStyle = { paddingTop: variants.insets.top, paddingBottom: variants.insets.bottom, paddingLeft: variants.insets.left, paddingRight: variants.insets.right, }; return ( <> {t('Calling...')} {OutgoingCallControls && ( )} ); }; const Background = () => { const { theme: { colors, outgoingCall }, } = useTheme(); const { useCameraState } = useCallStateHooks(); const { optimisticIsMute } = useCameraState(); if (optimisticIsMute) { return ( ); } return ( ); }; const styles = StyleSheet.create({ background: { flex: 1, }, container: { zIndex: Z_INDEX.IN_MIDDLE, }, topContainer: { flex: 1, justifyContent: 'center' }, content: { flex: 1, }, callingText: { marginTop: 16, textAlign: 'center', }, bottomContainer: { flex: 1, alignSelf: 'center', justifyContent: 'center' }, outgoingCallControls: { justifyContent: 'center', }, });