"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const prop_types_1 = __importDefault(require("prop-types"));
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
// TODO: support web
// @ts-ignore
const react_native_lightbox_1 = __importDefault(require("react-native-lightbox"));
const utils_1 = require("./utils");
const styles = react_native_1.StyleSheet.create({
    container: {},
    image: {
        width: 150,
        height: 100,
        borderRadius: 13,
        margin: 3,
        resizeMode: 'cover',
    },
    imageActive: {
        flex: 1,
        resizeMode: 'contain',
    },
});
class MessageImage extends react_1.Component {
    render() {
        const { containerStyle, lightboxProps, imageProps, imageStyle, currentMessage, } = this.props;
        if (currentMessage) {
            return (react_1.default.createElement(react_native_1.View, { style: [styles.container, containerStyle] },
                react_1.default.createElement(react_native_lightbox_1.default, Object.assign({ activeProps: {
                        style: styles.imageActive,
                    } }, lightboxProps),
                    react_1.default.createElement(react_native_1.Image, Object.assign({}, imageProps, { style: [styles.image, imageStyle], source: { uri: currentMessage.image } })))));
        }
        return null;
    }
}
exports.default = MessageImage;
MessageImage.defaultProps = {
    currentMessage: {
        image: null,
    },
    containerStyle: {},
    imageStyle: {},
    imageProps: {},
    lightboxProps: {},
};
MessageImage.propTypes = {
    currentMessage: prop_types_1.default.object,
    containerStyle: utils_1.StylePropType,
    imageStyle: utils_1.StylePropType,
    imageProps: prop_types_1.default.object,
    lightboxProps: prop_types_1.default.object,
};
//# sourceMappingURL=MessageImage.js.map