import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import ImageModal from '../../components/modals/ImageModal';
import { hiddenFieldValue } from '../../constants';
import { useTheme } from '../../contexts/theme';
import { testIdWithKey } from '../../utils/testable';
const RecordBinaryField = _ref => {
  let {
    attributeValue,
    shown,
    style
  } = _ref;
  const {
    ListItems
  } = useTheme();
  const {
    t
  } = useTranslation();
  const [showImageModal, setShowImageModal] = useState(false);
  const styles = StyleSheet.create({
    text: {
      ...ListItems.recordAttributeText
    },
    image: {
      height: 150,
      aspectRatio: 1,
      resizeMode: 'contain',
      borderRadius: 10
    }
  });
  return /*#__PURE__*/React.createElement(View, null, shown ? /*#__PURE__*/React.createElement(TouchableOpacity, {
    accessibilityLabel: t('Record.Zoom'),
    testID: testIdWithKey('zoom'),
    onPress: () => setShowImageModal(true)
  }, /*#__PURE__*/React.createElement(Image, {
    style: styles.image,
    source: {
      uri: attributeValue
    }
  })) : /*#__PURE__*/React.createElement(Text, {
    style: style || styles.text,
    testID: testIdWithKey('AttributeValue')
  }, hiddenFieldValue), showImageModal && /*#__PURE__*/React.createElement(ImageModal, {
    uri: attributeValue,
    onDismissPressed: () => setShowImageModal(false)
  }));
};
export default RecordBinaryField;
//# sourceMappingURL=RecordBinaryField.js.map