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 i18n from '../../../i18n'; import { getUserSelector } from '../../../selectors/login'; import { useTheme } from '../../../theme'; import { isIOS } from '../../methods/helpers'; import useUserData from '../useUserData'; export default function StartACallActionSheet({ rid }: { rid: string }): React.ReactElement { const { colors } = useTheme(); const [mic, setMic] = useState(true); const [cam, setCam] = useState(false); const [containerWidth, setContainerWidth] = useState(0); const username = useAppSelector(state => getUserSelector(state).username); const calling = useAppSelector(state => state.videoConf.calling); const dispatch = useDispatch(); const user = useUserData(rid); // fix safe area bottom padding on iOS const insets = useSafeAreaInsets(); const paddingBottom = isIOS && insets.bottom ? 8 : 0; React.useEffect( () => () => { if (calling) { dispatch(cancelCall({})); } }, [calling, dispatch] ); return ( setContainerWidth(e.nativeEvent.layout.width / 2)} > {calling ? : null} {cam ? ( ) : ( )}