import React, { FunctionComponent } from 'react';
import { StyleSheet, TouchableOpacity } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import { IButtonProps, IStyledProps } from '../../../common/types';

interface IProps extends IButtonProps, IStyledProps<{ image?: any }> {
  isMuted: boolean;
}

export const MicButtonView: FunctionComponent<IProps> = ({
  onPress,
  isMuted,
  style
}) => {
  style = { ...defaultStyle, ...style };
  const iconStyle = { ...defaultStyle.image, ...style.image }
  return (
    <TouchableOpacity onPress={onPress}>
      <Icon
        name={isMuted ? 'mic-off' : 'mic'}
        style={iconStyle}
        size={40}
        color="white"
      />
    </TouchableOpacity>
  );
};

const defaultStyle = StyleSheet.create({
  image: {
    fontSize: 40,
  },
});
