import { Camera, CameraType } from 'expo-camera'; import React, { useState } from 'react'; import { StyleSheet, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useDispatch } from 'react-redux'; import { useAppSelector } from '..'; import { cancelCall, initVideoCall } from '../../../actions/videoConf'; import AvatarContainer from '../../../containers/Avatar'; import Button from '../../../containers/Button'; import { CallHeader } from '../../../containers/CallHeader'; import Ringer, { ERingerSounds } from '../../../containers/Ringer'; import { SubscriptionType } from '../../../definitions'; import i18n from '../../../i18n'; import { getUserSelector } from '../../../selectors/login'; import { useTheme } from '../../../theme'; import useUserData from '../useUserData'; export default function StartACallActionSheet({ rid, roomType }: { rid: string; roomType?: SubscriptionType; }): React.ReactElement { const { colors } = useTheme(); const [mic, setMic] = useState(true); const [cam, setCam] = useState(false); const [containerWidth, setContainerWidth] = useState(0); const { bottom } = useSafeAreaInsets(); const username = useAppSelector(state => getUserSelector(state).username); const calling = useAppSelector(state => state.videoConf.calling); const dispatch = useDispatch(); const user = useUserData(rid); React.useEffect( () => () => { if (calling) { dispatch(cancelCall({})); } }, [calling, dispatch] ); return ( setContainerWidth(e.nativeEvent.layout.width / 2)} > {calling && roomType === SubscriptionType.DIRECT ? : null} {cam ? ( ) : ( )}