import React, { FunctionComponent } from 'react'; import { ImageSourcePropType } from 'react-native'; import { IP2PCall } from '../../../../../store/webrtc/types'; import { IImageButtonStyleProps, IStyledProps } from '../../../../common/types'; import { AnswerCallButtonView } from './AnswerAudioCallButtonView'; import { ImageButton } from '../../../../common/ImageButton'; import { useAppDispatch } from '../../../../../store/hooks'; import { takeCall } from '../../../../../store/webrtc/webrtcSlice'; export interface IAnswerCallBtnProps extends IStyledProps { call: IP2PCall imageSource?: ImageSourcePropType; renderOnPress?: (call: IP2PCall) => void; } export const AnswerAudioCallButton: FunctionComponent = ({ imageSource, renderOnPress, call, style }) => { const dispatch = useAppDispatch(); const AnswerAudioCall = () => { if (renderOnPress) { renderOnPress(call); } else { dispatch(takeCall(false)) } }; if (imageSource) { return } else { return ; } };